public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Constants::NS_MD, 'md:ContactPerson');
        $parent->appendChild($e);

        $e->setAttribute('contactType', $this->getContactType());

        foreach ($this->getContactPersonAttributes() as $attr => $val) {
            $e->setAttribute($attr, $val);
        }

        Extensions::addList($e, $this->getExtensions());

        if ($this->Company !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:Company', $this->Company);
        }
        if ($this->GivenName !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:GivenName', $this->GivenName);
        }
        if ($this->SurName !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:SurName', $this->SurName);
        }
        if (!empty($this->getEmailAddress())) {
            Utils::addStrings($e, Constants::NS_MD, 'md:EmailAddress', false, $this->getEmailAddress());
        }
        if (!empty($this->getTelephoneNumber())) {
            Utils::addStrings($e, Constants::NS_MD, 'md:TelephoneNumber', false, $this->getTelephoneNumber());
        }

        return $e;
    }
public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Constants::NS_MD, 'md:ContactPerson');
        $parent->appendChild($e);

        $e->setAttribute('contactType', $this->getContactType());

        foreach ($this->getContactPersonAttributes() as $attr => $val) {
            $e->setAttribute($attr, $val);
        }

        Extensions::addList($e, $this->getExtensions());

        if ($this->Company !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:Company', $this->Company);
        }
        if ($this->GivenName !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:GivenName', $this->GivenName);
        }
        if ($this->SurName !== null) {
            Utils::addString($e, Constants::NS_MD, 'md:SurName', $this->SurName);
        }
        if (!empty($this->getEmailAddress())) {
            Utils::addStrings($e, Constants::NS_MD, 'md:EmailAddress', false, $this->getEmailAddress());
        }
        if (!empty($this->getTelephoneNumber())) {
            Utils::addStrings($e, Constants::NS_MD, 'md:TelephoneNumber', false, $this->getTelephoneNumber());
        }

        return $e;
    }
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:ContactPerson' ) ; $ parent -> appendChild ( $ e ) ; $ e -> setAttribute ( 'contactType' , $ this -> getContactType ( ) ) ; foreach ( $ this -> getContactPersonAttributes ( ) as $ attr => $ val ) { $ e -> setAttribute ( $ attr , $ val ) ; } Extensions :: addList ( $ e , $ this -> getExtensions ( ) ) ; if ( $ this -> Company !== null ) { Utils :: addString ( $ e , Constants :: NS_MD , 'md:Company' , $ this -> Company ) ; } if ( $ this -> GivenName !== null ) { Utils :: addString ( $ e , Constants :: NS_MD , 'md:GivenName' , $ this -> GivenName ) ; } if ( $ this -> SurName !== null ) { Utils :: addString ( $ e , Constants :: NS_MD , 'md:SurName' , $ this -> SurName ) ; } if ( ! empty ( $ this -> getEmailAddress ( ) ) ) { Utils :: addStrings ( $ e , Constants :: NS_MD , 'md:EmailAddress' , false , $ this -> getEmailAddress ( ) ) ; } if ( ! empty ( $ this -> getTelephoneNumber ( ) ) ) { Utils :: addStrings ( $ e , Constants :: NS_MD , 'md:TelephoneNumber' , false , $ this -> getTelephoneNumber ( ) ) ; } return $ e ; }
Convert this ContactPerson to XML.

@param  \DOMElement $parent The element we should add this contact to.
@return \DOMElement The new ContactPerson-element.
Convert this ContactPerson to XML .