public function toXML( XMLWriter $XMLWriter )
    {
        $XMLWriter->startElement( 'Conexao' );

        if ($this->company) {
            $XMLWriter->writeElement( 'Companhia', $this->company );
        } else {
            throw new RequiredFieldException( 'Field Company of the Connection object is required' );
        }

        if ($this->flightNumber) {
            $XMLWriter->writeElement( 'NumeroVoo', $this->flightNumber );
        } else {
            throw new RequiredFieldException( 'Field FlightNumber of the Connection object is required' );
        }

        if ($this->flightDate) {
            $XMLWriter->writeElement( 'DataVoo', $this->flightDate->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field FlightDate of the Connection object is required' );
        }

        if ($this->class) {
            $XMLWriter->writeElement( 'Classe', $this->class );
        } else {
            throw new RequiredFieldException( 'Field Class of the Connection object is required' );
        }

        if ($this->from) {
            $XMLWriter->writeElement( 'Origem', $this->from );
        } else {
            throw new RequiredFieldException( 'Field FROM of the Connection object is required' );
        }

        if ($this->to) {
            $XMLWriter->writeElement( 'Destino', $this->to );
        } else {
            throw new RequiredFieldException( 'Field To of the Connection object is required' );
        }

        if ($this->departureDate) {
            $XMLWriter->writeElement( 'DataPartida', $this->departureDate->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field DepartureDate of the Connection object is required' );
        }

        if ($this->arrivalDate) {
            $XMLWriter->writeElement( 'DataChegada', $this->arrivalDate->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field ArrivalDate of the Connection object is required' );
        }

        $XMLWriter->endElement();
    }
public function toXML( XMLWriter $XMLWriter )
    {
        $XMLWriter->startElement( 'Conexao' );

        if ($this->company) {
            $XMLWriter->writeElement( 'Companhia', $this->company );
        } else {
            throw new RequiredFieldException( 'Field Company of the Connection object is required' );
        }

        if ($this->flightNumber) {
            $XMLWriter->writeElement( 'NumeroVoo', $this->flightNumber );
        } else {
            throw new RequiredFieldException( 'Field FlightNumber of the Connection object is required' );
        }

        if ($this->flightDate) {
            $XMLWriter->writeElement( 'DataVoo', $this->flightDate->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field FlightDate of the Connection object is required' );
        }

        if ($this->class) {
            $XMLWriter->writeElement( 'Classe', $this->class );
        } else {
            throw new RequiredFieldException( 'Field Class of the Connection object is required' );
        }

        if ($this->from) {
            $XMLWriter->writeElement( 'Origem', $this->from );
        } else {
            throw new RequiredFieldException( 'Field FROM of the Connection object is required' );
        }

        if ($this->to) {
            $XMLWriter->writeElement( 'Destino', $this->to );
        } else {
            throw new RequiredFieldException( 'Field To of the Connection object is required' );
        }

        if ($this->departureDate) {
            $XMLWriter->writeElement( 'DataPartida', $this->departureDate->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field DepartureDate of the Connection object is required' );
        }

        if ($this->arrivalDate) {
            $XMLWriter->writeElement( 'DataChegada', $this->arrivalDate->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field ArrivalDate of the Connection object is required' );
        }

        $XMLWriter->endElement();
    }
@param  \XMLWriter $XMLWriter

@throws \RodrigoPedra\ClearSaleID\Exception\RequiredFieldException