Parse an <xsl:value-of/> node into the internal representation

@param  DOMElement $ir   Node in the internal representation that represents the node's parent
@param  DOMElement $node <xsl:value-of/> node
@return void
962415
protected function parseXslValueOf(DOMElement $ir, DOMElement $node)
	{
		$this->appendXPathOutput($ir, $node->getAttribute('select'));
		if ($node->getAttribute('disable-output-escaping') === 'yes')
		{
			$ir->lastChild->setAttribute('disable-output-escaping', 'yes');
		}
	}
822551
protected function parseXslText(DOMElement $ir, DOMElement $node)
	{
		$this->appendLiteralOutput($ir, $node->textContent);
		if ($node->getAttribute('disable-output-escaping') === 'yes')
		{
			$ir->lastChild->setAttribute('disable-output-escaping', 'yes');
		}
	}
284402
protected function isTangler(DOMElement $element, DOMNode $node)
    {
        return
            !isset($this->containmentMap[$node->localName][$element->localName])
            || ($node instanceof DOMElement && $node->hasAttribute(static::ATTRIBUTE_INHERIT_TANGLEMENT))
        ;
    }
400864
private function parseElementAttributes(DOMElement $xml)
    {
        $attrs        = [];
        $elementAttrs = $xml->xpath('./@*');

        if (0 === $elementAttrs->length) {
            return $attrs;
        }

        foreach ($elementAttrs as $key => $attribute) {
            $value = static::getPhpValue($attribute->nodeValue, null, $this);
            $name = $this->normalizeKey($attribute->nodeName);
            $attrs[$this->prefixKey($name, $attribute->prefix ?: null)] = $value;
        }

        return [$this->getAttributesKey() => $attrs];
    }
814113
public function optimize(DOMDocument $ir)
	{
		$this->createXPath($ir);

		// Get a snapshot of current internal representation
		$xml = $ir->saveXML();

		// Set a maximum number of loops to ward against infinite loops
		$remainingLoops = 10;

		// From now on, keep looping until no further modifications are applied
		do
		{
			$old = $xml;
			$this->optimizeCloseTagElements($ir);
			$xml = $ir->saveXML();
		}
		while (--$remainingLoops > 0 && $xml !== $old);

		$this->removeCloseTagSiblings($ir);
		$this->removeContentFromVoidElements($ir);
		$this->mergeConsecutiveLiteralOutputElements($ir);
		$this->removeEmptyDefaultCases($ir);
	}
800688
public function toXML(DOMElement $parent = null) : DOMElement
    {
        $element = parent::toXML($parent);

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

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

        $value = $element->ownerDocument->createTextNode($this->value);
        $element->appendChild($value);

        return $element;
    }
916454
public function convertDOM($domElement) {

        $value = "";

        // Deal with straightforward primitives first.  These occur when a text node is passed
        if ($domElement instanceof \DOMText || $domElement instanceof \DOMAttr) {

            // Get the value
            $value = utf8_decode($domElement->nodeValue);

            // Handle booleans as special case
            if (strtolower($value) == "true") {
                $value = true;
            } elseif (strtolower($value) == "false") {
                $value = false;
            }

        } // Now deal with the inherently more complex element cases
        else if ($domElement instanceof \DOMElement) {

            // Get the name
            $elementName = $domElement->nodeName;

            // Handle the Array case next
            if (strtolower($elementName) == "array" || (isset($this->tagClassMap[$elementName]) && strtolower($this->tagClassMap [$elementName]) == "array")) {

                $value = array();

                // Loop through each child.  If we encounter "Value" elements we find the first child of the value item and pass this off for
                // recursive processing, otherwise we pass the child node off for processing and add the result to the array to return
                $arrayElements = $domElement->childNodes;
                for ($i = 0; $i < $arrayElements->length; $i++) {
                    $arrayElement = $arrayElements->item($i);

                    if ($arrayElement instanceof \DOMElement) {

                        $key = $arrayElement->getAttribute("key");

                        // Convert the value into an object
                        $convertedValue = $this->convertDOM($arrayElement);

                        // Now set the array value either with a key or not depending on whether a key attribute is set.
                        if (isset ($key) && $key) {
                            $value [$key] = $convertedValue;
                        } else {
                            $value [] = $convertedValue;
                        }
                    }
                }

            } // Handle the case where a value node is passed.  This only occurs in the case where a lazy array is defined
            // With a single entry.  Here we simply evaluate and pass back the child entity
            else if (strtolower($elementName) == "value") {

                $valueElements = $domElement->childNodes;

                // Check for the count of child nodes to see whether we need to implicitly create an array wrapper
                if ($valueElements->length == 0) {
                    $value = "";
                } else if ($valueElements->length == 1) {
                    $value = $this->convertDOM($valueElements->item(0));
                } else {
                    $value = array();
                    for ($j = 0; $j < $valueElements->length; $j++) {
                        $currentItem = $valueElements->item($j);
                        if (!($currentItem instanceof \DOMText) && !($currentItem instanceof \DOMComment)) {
                            $key = $currentItem->getAttribute("key");
                            if (isset ($key) && $key) {
                                $value [$key] = $this->convertDOM($currentItem);
                            } else {
                                $value [] = $this->convertDOM($currentItem);
                            }
                        }
                    }
                    // If the result was only in fact a single item, reduce the array to a single value again.
                    if (sizeof($value) == 1) {
                        $value = $value [0];
                    }
                }

            } // Otherwise we must be in the object case
            else {

                // Array of property sets which pertain to set or get methods.  These
                // ensure that we write non accessor members first and prevent
                // ordering problems when we provide custom functionality to write to
                // properties in other get / set methods.
                $deferredPropertySets = array();

                // If a mapping has been defined for this element, use the mapping
                if (isset ($this->tagClassMap [$elementName])) {
                    $elementName = $this->tagClassMap [$elementName];
                }

                // Create the class

                if (strtolower($elementName) == "value") {
                    $value = $this->convertDOM($domElement->childNodes->item(0));
                } else {
                    $value = $this->loadObject($domElement, $elementName);
                }
            }

        }

        return $value;

    }
334173
protected function parseXslComment(DOMElement $ir, DOMElement $node)
	{
		$comment = $this->appendElement($ir, 'comment');
		$this->parseChildren($comment, $node);
	}
213542
public static function closesParent(DOMElement $child, DOMElement $parent)
	{
		$parentName = $parent->nodeName;
		$childName  = $child->nodeName;

		return !empty(self::$htmlElements[$childName]['cp']) && in_array($parentName, self::$htmlElements[$childName]['cp'], true);
	}
479836
protected function addSequentialNode(DOMElement $element, $value): void
    {
        if (empty($element->nodeValue)) {
            $element->nodeValue = \htmlspecialchars($value);
            return;
        }

        $child = $this->element($element->nodeName);
        $child->nodeValue = \htmlspecialchars($value);
        $element->parentNode->appendChild($child);
    }
778876
public function setProperty(NodeInterface $node, \DOMElement $element) : void
    {
        if ($node instanceof ItemInterface) {
            $author = $node->newAuthor();
            $author->setName($element->nodeValue);
            $node->setAuthor($author);
        }
    }
557416
public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(EntityAttributes::NS, 'mdattr:EntityAttributes');
        $parent->appendChild($e);

        /** @var \SAML2\XML\saml\Attribute|\SAML2\XML\Chunk $child */
        foreach ($this->children as $child) {
            $child->toXML($e);
        }

        return $e;
    }
586064
private function fillElement (DOMDocument $doc, DOMElement $parent, array $filler)
    {
        foreach ($filler as $name => $value) {
            if ($value instanceof DOMElement) {
                $element = $value;
            } else {
                $element = $doc->createElement($name);
                
                if (is_array($value)) {
                    $this->fillElement($doc, $element, $value);
                } else {
                    $element->appendChild(new DOMCdataSection($value));
                }
            }
            
            $parent->appendChild($element);
        }
    }
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;
    }
1068773
protected function parseXslApplyTemplates(DOMElement $ir, DOMElement $node)
	{
		$applyTemplates = $this->appendElement($ir, 'applyTemplates');
		if ($node->hasAttribute('select'))
		{
			$applyTemplates->setAttribute('select', $node->getAttribute('select'));
		}
	}
146498
protected function mergeConsecutiveLiteralOutputElements(DOMDocument $ir)
	{
		foreach ($this->query('//output[@type="literal"]') as $output)
		{
			$disableOutputEscaping = $output->getAttribute('disable-output-escaping');
			while ($this->nextSiblingIsLiteralOutput($output, $disableOutputEscaping))
			{
				$output->nodeValue = htmlspecialchars($output->nodeValue . $output->nextSibling->nodeValue);
				$output->parentNode->removeChild($output->nextSibling);
			}
		}
	}
1247042
protected function addNode(DOMElement $element, $key, $value)
    {
        if ($this->replaceSpacesByUnderScoresInKeyNames) {
            $key = str_replace(' ', '_', $key);
        }

        $child = $this->document->createElement($key);
        $element->appendChild($child);
        $this->convertElement($child, $value);
    }