public function toXML(DOMElement $parent) : DOMElement
    {
        if ($this->KeyInfo === null) {
            throw new \Exception('Cannot convert KeyDescriptor to XML without KeyInfo set.');
        }

        $doc = $parent->ownerDocument;

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

        if ($this->use !== null) {
            $e->setAttribute('use', $this->use);
        }

        $this->KeyInfo->toXML($e);

        foreach ($this->EncryptionMethod as $em) {
            $em->toXML($e);
        }

        return $e;
    }
public function toXML(DOMElement $parent) : DOMElement
    {
        if ($this->KeyInfo === null) {
            throw new \Exception('Cannot convert KeyDescriptor to XML without KeyInfo set.');
        }

        $doc = $parent->ownerDocument;

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

        if ($this->use !== null) {
            $e->setAttribute('use', $this->use);
        }

        $this->KeyInfo->toXML($e);

        foreach ($this->EncryptionMethod as $em) {
            $em->toXML($e);
        }

        return $e;
    }
public function toXML ( DOMElement $ parent ) : DOMElement { if ( $ this -> KeyInfo === null ) { throw new \ Exception ( 'Cannot convert KeyDescriptor to XML without KeyInfo set.' ) ; } $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:KeyDescriptor' ) ; $ parent -> appendChild ( $ e ) ; if ( $ this -> use !== null ) { $ e -> setAttribute ( 'use' , $ this -> use ) ; } $ this -> KeyInfo -> toXML ( $ e ) ; foreach ( $ this -> EncryptionMethod as $ em ) { $ em -> toXML ( $ e ) ; } return $ e ; }
Convert this KeyDescriptor to XML.

@param \DOMElement $parent The element we should append this KeyDescriptor to.
@return \DOMElement
Convert this KeyDescriptor to XML .