src/XML/DOM/Builder.php
static protected function buildRecursive( DOMDocument $document, DOMElement $root, XML_DOM_Node $tree, $encoding )
	{
		foreach( $tree->getAttributes() as $key => $value )
		{
			$root->setAttribute( $key, $value );
		}
		if( $tree->hasChildren() )
		{
			$children = $tree->getChildren();
			foreach( $children as $child )
			{
				$element = $document->createElement( $child->getNodename() );
				self::buildRecursive( $document, $element, $child, $encoding );
				$element = $root->appendChild( $element );
			}
		}
		else if( $tree->hasContent() )
		{
			$text	= (string) $tree->getContent();
			$text	= $document->createTextNode( $text );
			$text	= $root->appendChild( $text );
		}
	}
static protected function buildRecursive( DOMDocument $document, DOMElement $root, XML_DOM_Node $tree, $encoding )
	{
		foreach( $tree->getAttributes() as $key => $value )
		{
			$root->setAttribute( $key, $value );
		}
		if( $tree->hasChildren() )
		{
			$children = $tree->getChildren();
			foreach( $children as $child )
			{
				$element = $document->createElement( $child->getNodename() );
				self::buildRecursive( $document, $element, $child, $encoding );
				$element = $root->appendChild( $element );
			}
		}
		else if( $tree->hasContent() )
		{
			$text	= (string) $tree->getContent();
			$text	= $document->createTextNode( $text );
			$text	= $root->appendChild( $text );
		}
	}
static protected function buildRecursive ( DOMDocument $ document , DOMElement $ root , XML_DOM_Node $ tree , $ encoding ) { foreach ( $ tree -> getAttributes ( ) as $ key => $ value ) { $ root -> setAttribute ( $ key , $ value ) ; } if ( $ tree -> hasChildren ( ) ) { $ children = $ tree -> getChildren ( ) ; foreach ( $ children as $ child ) { $ element = $ document -> createElement ( $ child -> getNodename ( ) ) ; self :: buildRecursive ( $ document , $ element , $ child , $ encoding ) ; $ element = $ root -> appendChild ( $ element ) ; } } else if ( $ tree -> hasContent ( ) ) { $ text = ( string ) $ tree -> getContent ( ) ; $ text = $ document -> createTextNode ( $ text ) ; $ text = $ root -> appendChild ( $ text ) ; } }
Writes XML Tree to XML File recursive.
@static
@access		protected
@param		DOMElement		$document	DOM Document
@param		DOMElement		$root		DOM Element
@param		XML_DOM_Node	$tree		Parent XML Node
@param		string			$encoding	Encoding Character Set (utf-8 etc.)
@return		void
Writes XML Tree to XML File recursive .