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

        if ($this->id) {
            $XMLWriter->writeElement( 'CodigoItem', $this->id );
        } else {
            throw new RequiredFieldException( 'Field ID of the Item object is required' );
        }

        if ($this->name) {
            $XMLWriter->writeElement( 'NomeItem', $this->name );
        } else {
            throw new RequiredFieldException( 'Field Name of the Item object is required' );
        }

        if ($this->value) {
            $XMLWriter->writeElement( 'ValorItem', $this->value );
        } else {
            throw new RequiredFieldException( 'Field ItemValue of the Item object is required' );
        }

        if ($this->quantity) {
            $XMLWriter->writeElement( 'Quantidade', $this->quantity );
        } else {
            throw new RequiredFieldException( 'Field Quantity of the Item object is required' );
        }

        if ($this->notes) {
            $XMLWriter->writeElement( 'Generico', $this->notes );
        }

        if ($this->categoryId) {
            $XMLWriter->writeElement( 'CodigoCategoria', $this->categoryId );
        }

        if ($this->categoryName) {
            $XMLWriter->writeElement( 'NomeCategoria', $this->categoryName );
        }

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

        if ($this->id) {
            $XMLWriter->writeElement( 'CodigoItem', $this->id );
        } else {
            throw new RequiredFieldException( 'Field ID of the Item object is required' );
        }

        if ($this->name) {
            $XMLWriter->writeElement( 'NomeItem', $this->name );
        } else {
            throw new RequiredFieldException( 'Field Name of the Item object is required' );
        }

        if ($this->value) {
            $XMLWriter->writeElement( 'ValorItem', $this->value );
        } else {
            throw new RequiredFieldException( 'Field ItemValue of the Item object is required' );
        }

        if ($this->quantity) {
            $XMLWriter->writeElement( 'Quantidade', $this->quantity );
        } else {
            throw new RequiredFieldException( 'Field Quantity of the Item object is required' );
        }

        if ($this->notes) {
            $XMLWriter->writeElement( 'Generico', $this->notes );
        }

        if ($this->categoryId) {
            $XMLWriter->writeElement( 'CodigoCategoria', $this->categoryId );
        }

        if ($this->categoryName) {
            $XMLWriter->writeElement( 'NomeCategoria', $this->categoryName );
        }

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

@throws \RodrigoPedra\ClearSaleID\Exception\RequiredFieldException