Builds a Renewable object from XML.

@param \DOMElement $xml
The xml element containing the renewable information.

@return Renewable
A Renewable object.
487763
public static function fromXml(\DOMElement $xml)
    {
        $static = new static();

        $isRenewable = $xml->getElementsByTagName('renewable');
        $static->isRenewable = BoolLiteral::fromXml($isRenewable);
        $message = $xml->getElementsByTagName('renewableMessage');
        $static->message = StringLiteral::fromXml($message);
        $cost = $xml->getElementsByTagName('renewalCost');
        $static->cost = StringLiteral::fromXml($cost);

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

        $e = $doc->createElementNS(Common::NS, 'mdui:Logo');
        $e->appendChild($doc->createTextNode($this->url));
        $e->setAttribute('width', strval($this->width));
        $e->setAttribute('height', strval($this->height));
        if ($this->lang !== null) {
            $e->setAttribute('xml:lang', $this->lang);
        }
        $parent->appendChild($e);

        return $e;
    }
342915
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::same($this->getElement()->namespaceURI, Constants::NS_SAML);
        Assert::same($this->getElement()->localName, "AttributeValue");

        return Utils::copyElement($this->element, $parent);
    }
975474
protected function unmarshall(DOMElement $element)
    {
        $baseComponent = parent::unmarshall($element);
        $object = new NumberPresented();
        $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
        $object->setIncludeCategories($baseComponent->getIncludeCategories());
        $object->setExcludeCategories($baseComponent->getExcludeCategories());

        return $object;
    }
698606
public static function toDOMDocument($xml)
    {
        if ($xml instanceof \DOMDocument) {
            return $xml;
        }

        if ($xml instanceof \SimpleXMLElement) {
            $doc = new \DOMDocument();
            $doc->loadXML('' . $xml->asXML());

            return $doc;
        }

        if (is_string($xml)) {
            $doc = new \DOMDocument();

            if (is_file($xml)) {
                $doc->load($xml);

                return $doc;
            }

            $doc->loadXML($xml);

            return $doc;
        }

        $type = is_object($xml) ? get_class($xml) : gettype($xml);

        throw new \InvalidArgumentException("Cannot convert instance of '$type' to DOMDocument");
    }
1281710
protected function generateXMLObject($xml)
    {
        try {
            libxml_use_internal_errors(true);
            return new SimpleXMLElement($xml, LIBXML_NOCDATA);
        } catch (\Exception $e) {
            return false;
        }
    }
469277
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notEmpty($this->publisher, "Cannot convert PublicationInfo to XML without a publisher set.");

        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Common::NS_MDRPI, 'mdrpi:PublicationInfo');
        $parent->appendChild($e);

        $e->setAttribute('publisher', $this->publisher);

        if ($this->creationInstant !== null) {
            $e->setAttribute('creationInstant', gmdate('Y-m-d\TH:i:s\Z', $this->creationInstant));
        }

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

        Utils::addStrings($e, Common::NS_MDRPI, 'mdrpi:UsagePolicy', true, $this->UsagePolicy);

        return $e;
    }
402009
public function toXML(DOMElement $parent = null) : DOMElement
    {
        if ($parent === null) {
            $parent = DOMDocumentFactory::create();
            $doc = $parent;
        } else {
            $doc = $parent->ownerDocument;
        }
        $element = $doc->createElementNS(Constants::NS_SAML, $this->nodeName);
        $parent->appendChild($element);

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

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

        return $element;
    }
1296578
public function toXML(DOMElement $parent) : ?DOMElement
    {
        if (!empty($this->IPHint)
         || !empty($this->DomainHint)
         || !empty($this->GeolocationHint)
         || !empty($this->children)
        ) {
            $doc = $parent->ownerDocument;

            $e = $doc->createElementNS(Common::NS, 'mdui:DiscoHints');
            $parent->appendChild($e);

            foreach ($this->getChildren() as $child) {
                $child->toXML($e);
            }

            Utils::addStrings($e, Common::NS, 'mdui:IPHint', false, $this->IPHint);
            Utils::addStrings($e, Common::NS, 'mdui:DomainHint', false, $this->DomainHint);
            Utils::addStrings($e, Common::NS, 'mdui:GeolocationHint', false, $this->GeolocationHint);

            return $e;
        }

        return null;
    }
112141
public static function fromXml(\DOMElement $xml)
    {
        $static = new static();

        $title = $xml->getElementsByTagName('title');
        $static->title = StringLiteral::fromXml($title);

        $author = $xml->getElementsByTagName('author');
        $static->author = StringLiteral::fromXml($author);

        $year = $xml->getElementsByTagName('year');
        $static->year = StringLiteral::fromXml($year);

        $imprint = $xml->getElementsByTagName('imprint');
        $static->imprint = StringLiteral::fromXml($imprint);

        $url = $xml->getElementsByTagName('docUrl');
        $static->url = Path::fromXml($url);

        $isbnIssn = $xml->getElementsByTagName('isbn_issn');
        $static->isbnIssn = StringLiteral::fromXml($isbnIssn);

        $docNumber = $xml->getElementsByTagName('docNumber');
        $static->docNumber = StringLiteral::fromXml($docNumber);

        $itemId = $xml->getElementsByTagName('itemId');
        $static->itemId = StringLiteral::fromXml($itemId);

        return $static;
    }
114890
public function toXML(DOMNode $parentElement = null) : DOMElement
    {
        if ($parentElement === null) {
            $document = DOMDocumentFactory::create();
            $parentElement = $document;
        } else {
            $document = $parentElement->ownerDocument;
        }

        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedAssertion');
        $parentElement->appendChild($root);

        $root->appendChild($document->importNode($this->encryptedData, true));

        return $root;
    }
900263
public function toUnsignedXML() : DOMElement
    {
        $root = parent::toUnsignedXML();

        if ($this->inResponseTo !== null) {
            $root->setAttribute('InResponseTo', $this->inResponseTo);
        }

        $status = $this->document->createElementNS(Constants::NS_SAMLP, 'Status');
        $root->appendChild($status);

        $statusCode = $this->document->createElementNS(Constants::NS_SAMLP, 'StatusCode');
        $statusCode->setAttribute('Value', $this->status['Code']);
        $status->appendChild($statusCode);

        if (!is_null($this->status['SubCode'])) {
            $subStatusCode = $this->document->createElementNS(Constants::NS_SAMLP, 'StatusCode');
            $subStatusCode->setAttribute('Value', $this->status['SubCode']);
            $statusCode->appendChild($subStatusCode);
        }

        if (!is_null($this->status['Message'])) {
            Utils::addString($status, Constants::NS_SAMLP, 'StatusMessage', $this->status['Message']);
        }

        return $root;
    }
574278
private function createRelationsElement($xml)
    {
        $relations = $xml->createElement('relations');

        foreach ($this->relations as $type => $rr) {
            foreach ($rr as $relation) {
                $relations->appendChild($this->createRelationElement($xml, $type, $relation));
            }
        }

        return $relations;
    }
46412
private function convertDocument(\DOMDocument $xml)
    {
        return $this->loader->load($xml->saveXML(), [LoaderInterface::FROM_STRING => true]);
    }
1334063
private function createDomDocument($xml)
    {
        $domDocument = new \DOMDocument();
        if ($domDocument->loadXML($xml) === false) {
            throw new ParseException("Could not parse xml input");
        }
        return $domDocument;
    }
1112385
public function parse( $xml )
	{
		$this->loadXml( $xml );
		$root	= $this->document->firstChild;
		while( $root->nodeType == XML_COMMENT_NODE )
			$root	= $root->nextSibling;

		$tree	= new XML_DOM_Node( $root->nodeName );
		if( $root->hasAttributes())
		{
			$attributeNodes	= $root->attributes;
			foreach( $attributeNodes as $attributeNode )
				$tree->setAttribute( $attributeNode->nodeName, $attributeNode->nodeValue );
		}
		$this->parseRecursive( $root, $tree );
		return $tree;
	}
957577
public function toXML(DOMElement $parent) : DOMElement
    {
        return Utils::addString($parent, XMLSecurityDSig::XMLDSIGNS, 'ds:X509Certificate', $this->getCertificate());
    }