buildXML

@param DOMNode $node
@param mixed $data

@return void
480409
protected function buildXML(DOMDocument $dom, \DOMNode $node, $data)
    {
        $normalizer = $this->getNormalizer();

        if (null === $data) {
            return;
        }

        if ((is_array($data) || $data instanceof \Traversable) && !$this->isXmlElement($data)) {
            return $this->buildXmlFromTraversable($dom, $node, $normalizer->ensureBuildable($data));
        }

        $this->setElementValue($dom, $node, $data);
    }
182821
protected function appendNode(DOMNode $node, $xquery = null)
    {
      // Determine parent node
      if(!is_null($xquery))
        $parentNode = $this->getNode($xquery);
      else if(!is_null($this->node))
        $parentNode = $this->node;
      else
        $parentNode = $this->document;

      $parentNode->appendChild($node);
    }
996354
private function arrayToXml(array &$data, SimpleXMLElement $xmlData)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value)) {
                if (\is_numeric($key)) {
                    $key = 'sequential-item';
                }
                $subnode = $xmlData->addChild($key);

                $this->arrayToXml($value, $subnode);
            } else {
                $subnode = $xmlData->addChild("$key", "$value");

                $type = \gettype($value);
                if ('array' !== $type) {
                    $subnode->addAttribute('type', $type);
                }
            }
        }
    }
1205190
private function appendNode(\DOMNode $parentNode, $data, string $nodeName, string $key = null): bool
    {
        $node = $this->dom->createElement($nodeName);
        if (null !== $key) {
            $node->setAttribute('key', $key);
        }
        $appendNode = $this->selectNodeType($node, $data);
        // we may have decided not to append this node, either in error or if its $nodeName is not valid
        if ($appendNode) {
            $parentNode->appendChild($node);
        }

        return $appendNode;
    }
616209
public function execute(NodeData $node)
    {
        $dimensions = [];
        foreach ($this->dimensionValues as $dimensionName => $dimensionConfiguration) {
            foreach ($dimensionConfiguration as $dimensionValues) {
                if (is_array($dimensionValues)) {
                    foreach ($dimensionValues as $dimensionValue) {
                        $dimensions[] = new NodeDimension($node, $dimensionName, $dimensionValue);
                    }
                } else {
                    $dimensions[] = new NodeDimension($node, $dimensionName, $dimensionValues);
                }
            }
        }

        if ($this->addDefaultDimensionValues === true) {
            $configuredDimensions = $this->contentDimensionRepository->findAll();
            foreach ($configuredDimensions as $configuredDimension) {
                if (!isset($this->dimensionValues[$configuredDimension->getIdentifier()])) {
                    $dimensions[] = new NodeDimension($node, $configuredDimension->getIdentifier(), $configuredDimension->getDefault());
                }
            }
        }

        $node->setDimensions($dimensions);
    }
1285708
protected function xmlSerialize($data, $xml = null)
    {
        if ( !$xml instanceof SimpleXMLElement )
        {
            $xml = new SimpleXMLElement('<'. $this->requestName .' xmlns="'. $this->namespace .'" />');
        }

        foreach ($data as $key => $value)
        {
            if ( !isset($value) )
            {
                continue;
            }

            if ( is_array($value) )
            {
                $node = $xml->addChild($key);
                $this->xmlSerialize($value, $node);
            }
            else
            {
                $xml->addChild($key, $value);
            }
        }

        return $xml->asXML();
    }
98954
protected function getHTMLNodeBase($node, $xml, $settings, $css, &$javascripts)
    {
        parent::getHTMLNodeBase($node, $xml, $settings, $css, $javascripts);
        $node->setAttribute('data-zoom', $this->zoom);
    }
314133
private function buildXml($data, \DOMDocument $doc, \DOMNode $parentNode = null)
    {
        if (is_array($data)) {
            foreach ($data as $elementName => $element) {
                if (is_int($elementName)) {
                    $elementName = 'item';
                }

                $newElement = $doc->createElement($elementName);

                if ($parentNode) {
                    $parentNode->appendChild($newElement);
                } else {
                    $doc->appendChild($newElement);
                }

                $this->buildXml($element, $doc, $newElement);
            }
        } else {
            $parentNode->nodeValue = $data;
        }
    }
1069461
protected function _RenderXml($Data, $Node = 'Data', $Indent = '') {
      // Handle numeric arrays.
      if (is_numeric($Node))
         $Node = 'Item';

      if (!$Node)
         return;
      
      echo "$Indent<$Node>";

      if (is_scalar($Data)) {
         echo htmlspecialchars($Data);
      } else {
         $Data = (array)$Data;
         if (count($Data) > 0) {
            foreach ($Data as $Key => $Value) {
               echo "\n";
               $this->_RenderXml($Value, $Key, $Indent.' ');
            }
            echo "\n";
         }
      }
      echo "</$Node>";
   }
533456
public function execute($content, $data = [])
    {

        //return $content;
        $this->loader->addData($data);

        $tpl = new DOMDocument();

        $tpl->resolveExternals = true;
        $tpl->preserveWhiteSpace = false;

        //libxml_use_internal_errors(true);
        $tpl->loadXML($content, LIBXML_COMPACT & LIBXML_NOBLANKS & LIBXML_DTDATTR);
        //$this->masterName = $tpl->documentElement->attributes->getNamedItem("name")->nodeValue;
        $this->xPath = new DOMXPath($tpl);

        $this->walk($tpl, $data);

        //It is not ideal to removeNodes from the Remove Queue whilst we walk over it, therefore,
        //Some nodes might need to be removed after iteration;
        return "<!DOCTYPE html>\n".trim($tpl->saveHTML());
    }
1331195
protected static function DOMNodeAttributes(DOMNode $node)
    {
        $attributes = array();

        foreach ($node->attributes as $attribute) {
            $attributes[$attribute->name] = $attribute->value;
        }

        return $attributes;
    }
391683
static public function build( XML_DOM_Node $tree, $encoding = "utf-8", $namespaces = array() )
	{
		$document	= new DOMDocument( "1.0", $encoding );
		$document->formatOutput = TRUE;
		$root		= $document->createElement( $tree->getNodename() );
		foreach( $namespaces as $prefix => $namespace )
			$root->setAttribute( "xmlns:".$prefix, $namespace );
		$root		= $document->appendChild( $root );
		self::buildRecursive( $document, $root, $tree, $encoding );
		return $document->saveXML();
	}
1329536
private function nodeToArray(DOMNode $node)
    {
        $xml = simplexml_import_dom($node, 'Nijens\\Utilities\\Configuration\\JSONSerializableXMLElement');
        $json = json_encode($xml);

        return json_decode($json, true);
    }
543311
public function handle(NodeInterface $node, array $data)
    {
        if ($node->getNodeType()->isOfType('Neos.Neos:Document')) {
            if (isset($data['title'])) {
                $node->setProperty('title', $data['title']);
            }
            $node->setProperty('uriPathSegment', $this->nodeUriPathSegmentGenerator->generateUriPathSegment($node, (isset($data['title']) ? $data['title'] : null)));
        }
    }
744070
public static function createFromXML( DOMElement $node )
    {
        $newObj = new eZPageZone();

        if ( $node->hasAttributes() )
        {
            foreach ( $node->attributes as $attr )
            {
                if ( $attr->name == 'id' )
                {
                    $value = explode( '_', $attr->value );
                    $newObj->setAttribute( $attr->name, $value[1] );
                }
                else
                {
                    $newObj->setAttribute( $attr->name, $attr->value );
                }
            }
        }

        foreach ( $node->childNodes as $node )
        {
            if ( $node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'block' )
            {
                $blockNode = eZPageBlock::createFromXML( $node );
                $newObj->addBlock( $blockNode );
            }
            elseif ( $node->nodeType == XML_ELEMENT_NODE )
            {
                $newObj->setAttribute( $node->nodeName, $node->nodeValue );
            }
        }

        return $newObj;
    }
128719
protected function childbearing(\DOMNode $node)
    {
        if ($node->hasChildNodes())
        {
            foreach ($node->childNodes as $child)
            {
                if ($child->nodeType === XML_ELEMENT_NODE)
                {
                    return true;
                }
            }
        }

        return false;
    }
154814
protected function convertDom(\DOMNode $node)
    {
        $isArray = false;
        $current = array();
        $text = '';

        if ($node instanceof \DOMElement) {
            foreach ($node->attributes as $name => $attribute) {
                $current["_{$name}"] = $attribute->value;
            }
        }

        $parentTagName = $node instanceof \DOMElement ? $node->tagName : false;
        foreach ($node->childNodes as $childNode) {
            switch ($childNode->nodeType) {
                case XML_ELEMENT_NODE:
                    $tagName = $childNode->tagName;

                    if (in_array($tagName, $this->fieldTypeHashElements)) {
                        $current[$tagName] = $this->parseFieldTypeHash($childNode);
                    } elseif (!isset($current[$tagName])) {
                        if (isset($this->forceList[$parentTagName]) &&
                             in_array($tagName, $this->forceList[$parentTagName], true)) {
                            $isArray = true;
                            $current[$tagName] = array(
                                $this->convertDom($childNode),
                            );
                        } else {
                            $current[$tagName] = $this->convertDom($childNode);
                        }
                    } elseif (!$isArray) {
                        $current[$tagName] = array(
                            $current[$tagName],
                            $this->convertDom($childNode),
                        );
                        $isArray = true;
                    } else {
                        $current[$tagName][] = $this->convertDom($childNode);
                    }

                    break;

                case XML_TEXT_NODE:
                    $text .= $childNode->wholeText;
                    break;

                case XML_CDATA_SECTION_NODE:
                    $text .= $childNode->data;
                    break;
            }
        }

        $text = trim($text);

        if ($text !== '' && count($current)) {
            $current['#text'] = $text;
        } elseif ($text !== '') {
            $current = $text;
        } elseif (!count($current)) {
            return null;
        }

        return $current;
    }