Appends XML nodes to passed-in DOMNode.

@param DOMNode $node
191449
public function appendXml(DOMNode $node)
    {
        $doc = ($node instanceof DOMDocument) ? $node : $node->ownerDocument;

        $tableNode = $node->appendChild($doc->createElement('table'));
        $tableNode->setAttribute('name', $this->getCommonName());

        if ($this->getSchema() !== null) {
            $tableNode->setAttribute('schema', $this->getSchema());
        }

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

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

        if ($this->skipSql !== null) {
            $tableNode->setAttribute('skipSql', var_export($this->skipSql, true));
        }

        if ($this->readOnly !== null) {
            $tableNode->setAttribute('readOnly', var_export($this->readOnly, true));
        }

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

        if ($this->reloadOnInsert !== null) {
            $tableNode->setAttribute('reloadOnInsert', var_export($this->reloadOnInsert, true));
        }

        if ($this->reloadOnUpdate !== null) {
            $tableNode->setAttribute('reloadOnUpdate', var_export($this->reloadOnUpdate, true));
        }

        if ($this->forReferenceOnly !== null) {
            $tableNode->setAttribute('forReferenceOnly', var_export($this->forReferenceOnly, true));
        }

        if ($this->abstractValue !== null) {
            $tableNode->setAttribute('abstract', var_export($this->abstractValue, true));
        }

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

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

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

        if ($this->pkg !== null && !$this->pkgOverridden) {
            $tableNode->setAttribute('package', $this->pkg);
        }

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

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

        if ($this->getIsCrossRef()) {
            $tableNode->setAttribute('isCrossRef', $this->getIsCrossRef());
        }

        foreach ($this->columnList as $col) {
            $col->appendXml($tableNode);
        }

        foreach ($this->validatorList as $validator) {
            $validator->appendXml($tableNode);
        }

        foreach ($this->foreignKeys as $fk) {
            $fk->appendXml($tableNode);
        }

        foreach ($this->idMethodParameters as $param) {
            $param->appendXml($tableNode);
        }

        foreach ($this->indices as $index) {
            $index->appendXml($tableNode);
        }

        foreach ($this->unices as $unique) {
            $unique->appendXml($tableNode);
        }

        foreach ($this->vendorInfos as $vi) {
            $vi->appendXml($tableNode);
        }
    }
603965
public function addChildAsLast(Node $node)
    {
        if(null === $this->children)
        {
            $this->children = array();
        }

        $this->children[] = $node;
    }
1187630
private function visitNode(\DOMNode $node)
    {
        if ($this->node !== $node) {
            $this->node->appendChild($node);
        }

        return $node;
    }
1268553
public function addNode(Node $node)
    {
        $node->setNavigation($this);
        $this->nodes[] = $node;

        return $this;
    }
869747
public function addChild(self $node)
	{
		$index = count($this->node_children);
		$this->insertChildAt($index, $node);
	}
251088
protected function checkNode(DOMNode $node, Tag $tag)
	{
		if ($node instanceof DOMAttr)
		{
			$this->checkAttributeNode($node, $tag);
		}
		elseif ($node instanceof DOMElement)
		{
			if ($node->namespaceURI === self::XMLNS_XSL && $node->localName === 'copy-of')
			{
				$this->checkCopyOfNode($node, $tag);
			}
			else
			{
				$this->checkElementNode($node, $tag);
			}
		}
	}
823910
public function enterNode(Node $node)
    {
        if ($node instanceof Stmt\Namespace_) {
            $this->namespaceNode = $node->name;
        } elseif ($node instanceof Stmt\GroupUse) {
            foreach ($node->uses as $use) {
                $this->importNodes[] = Name::concat($node->prefix, $use->name);
            }
        } elseif ($node instanceof Stmt\Use_) {
            foreach ($node->uses as $use) {
                $this->importNodes[] = $use->name;
            }
        } elseif ($node instanceof Stmt\Class_) {
            $this->classNode = $node;
        }
    }
122964
protected function &convert(\DOMNode $node)
    {
        $output = array();

        $this->collateNamespaces($node);
        switch ($node->nodeType) {
            case XML_CDATA_SECTION_NODE:
                $output[$this->config['cdataKey']] = trim($node->textContent);
                break;

            case XML_TEXT_NODE:
                $output = trim($node->textContent);
                break;

            case XML_ELEMENT_NODE:

                // for each child node, call the covert function recursively
                for ($i = 0, $m = $node->childNodes->length; $i < $m; $i++) {
                    $child = $node->childNodes->item($i);
                    $v = $this->convert($child);
                    if (isset($child->tagName)) {
                        $t = $child->nodeName;

                        // assume more nodes of same kind are coming
                        if ( ! isset($output[$t])) {
                            $output[$t] = array();
                        }
                        $output[$t][] = $v;
                    } else {
                        //check if it is not an empty text node
                        if ($v !== '') {
                            $output = $v;
                        }
                    }
                }

                if (is_array($output)) {
                    // if only one node of its kind, assign it directly instead if array($value);
                    foreach ($output as $t => $v) {
                        if (is_array($v) && count($v) == 1) {
                            $output[$t] = $v[0];
                        }
                    }
                    if (empty($output)) {
                        //for empty nodes
                        $output = '';
                    }
                }

                // loop through the attributes and collect them
                if ($node->attributes->length) {
                    $a = array();
                    foreach ($node->attributes as $attributeName => $attributeNode) {
                        $attributeName = $attributeNode->nodeName;
                        $a[$attributeName] = (string) $attributeNode->value;
                        $this->collateNamespaces($attributeNode);
                    }
                    // if its an leaf node, store the value in @value instead of directly storing it.
                    if ( ! is_array($output)) {
                        $output = array($this->config['valueKey'] => $output);
                    }
                    $output[$this->config['attributesKey']] = $a;
                }
                break;
        }
        return $output;
    }
329648
private function sanitizeNode(DOMNode $node)
    {
        // Traverse the nodes, without foreach because nodes may be removed
        $child = (!empty($node->childNodes) && $node->childNodes->length > 0) ? $node->childNodes->item(0) : null;
        while ($child !== null)
        {
            $tag = $child->nodeName;

            // Allow text nodes
            if ($tag === "#text")
            {
                $child = $child->nextSibling;
                continue;
            }

            if (isset($this->remove_tags[$tag]))
            {
                // Tag is on the list of nodes to fully remove including child nodes
                $remove = $child;
                $child = $child->nextSibling;
                $node->removeChild($remove);
            }
            elseif (!isset($this->allowed_tags[$tag]))
            {
                // Add the child nodes of the disalowed tag to the parent node in its place,
                // and move the pointer to the first inserted child node, or the next node.
                $child = $this->unwrapContents($node, $child);
            }
            else
            {
                // Sanitize the attributes of an allowed tag
                if ($child->attributes !== null)
                    $this->sanitizeAttributes($child);

                // And now process the contents
                $this->sanitizeNode($child);

                // Finally, call a callback if applicable
                if (isset($this->tag_callback[$tag]))
                    $this->tag_callback[$tag]($child);

                $child = $child->nextSibling;
            }
        }
    }
115727
public function insert(Node $node) : void
    {
        $node->setParent($this->scope);
        $this->scope->insert($node);
    }
1211401
public function addNode(Node $node)
    {
        foreach ($this->nodes as $n) {
            if ($n->getIdentifier() === $node->getIdentifier()) {
                throw new SchemaDefinitionException(sprintf('The node with Identifier "%s" has already been declared', $node->getIdentifier()));
            }
        }

        return $this->nodes->add($node);
    }
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;
    }
1054941
private function prepareNode(&$node, $key)
    {
        if (!isset($node[$key])) {
            $node[$key] = null;
        } elseif (!is_array($node[$key])) {
            $node[$key] = [$node[$key]];
        }
    }
952052
public function removeNode(Node $node)
    {
        $node->setNavigation(null);
        $this->nodes->removeElement($node);
    }
254512
public function mergeNode(ParentNode $node) {
    $child = $node->head;
    while ($child) {
      $next = $child->next;
      $this->appendChild($child);
      $child = $next;
    }
    foreach ($node->getChildProperties() as $name => $value) {
      $this->{$name} = $value;
    }
  }
1269396
public function addNode(Node $node)
    {
        if (isset($this->idList[$node->id])) {
            /**
             * @todo -> fix this behavior so the get last is working again
             */
            $node->setId($this->getNextPossibleIdInContext($node));
        }

        // add to the keylist for iterations
        if (isset($this->keyList[$node->key])) {
            $this->keyList[$node->key]->push($node);
        } else {
            $this->keyList[$node->key] = new \SplDoublyLinkedList();
            $this->keyList[$node->key]->push($node);
        }

        $this->list[$node->key]  = $node;
        $this->idList[$node->id] = $node;

        return $this;
    }
317900
protected function pushChildNode(Element $node)
    {
        $node->attributes->addAttributeClass('list-group-item');

        if ($node instanceof Lists\Item) {
            $node->setContextualClassPrefix('list-group-item');
        }

        parent::pushChildNode($node);
    }