public function toNode(DOMDocument $document = null)
    {
        if (null === $document) {
            $document = new DOMDocument();
        }

        $node = $document->createElement('Weight');

        // Required
        $node->appendChild($document->createElement('Value', $this->getValue()));

        // Optional
        if ($this->getUnitOfMeasurement() instanceof UnitOfMeasurement) {
            $node->appendChild($this->getUnitOfMeasurement()->toNode($document));
        }

        return $node;
    }
public function toNode(DOMDocument $document = null)
    {
        if (null === $document) {
            $document = new DOMDocument();
        }

        $node = $document->createElement('Weight');

        
        $node->appendChild($document->createElement('Value', $this->getValue()));

        
        if ($this->getUnitOfMeasurement() instanceof UnitOfMeasurement) {
            $node->appendChild($this->getUnitOfMeasurement()->toNode($document));
        }

        return $node;
    }
public function toNode ( DOMDocument $ document = null ) { if ( null === $ document ) { $ document = new DOMDocument ( ) ; } $ node = $ document -> createElement ( 'Weight' ) ; // Required $ node -> appendChild ( $ document -> createElement ( 'Value' , $ this -> getValue ( ) ) ) ; // Optional if ( $ this -> getUnitOfMeasurement ( ) instanceof UnitOfMeasurement ) { $ node -> appendChild ( $ this -> getUnitOfMeasurement ( ) -> toNode ( $ document ) ) ; } return $ node ; }
@param null|DOMDocument $document

@return DOMElement
@param null|DOMDocument $document