src/XML/DOM/Parser.php
protected function parseRecursive( $root, $tree )
	{
		$nodes = array();
		if( $child = $root->firstChild )
		{
			while( $child )
			{
				$attributes	= $child->hasAttributes()? $child->attributes : array();
				switch( $child->nodeType )
				{
					case XML_ELEMENT_NODE:
						$node = new XML_DOM_Node( $child->nodeName );
						if( !$this->parseRecursive( $child, $node ) )
						{
	#						$node->setContent( utf8_decode( $child->textContent ) );
							$node->setContent( $child->textContent );
						}
						foreach( $attributes as $attribute)
							$node->setAttribute( $attribute->nodeName, stripslashes( $attribute->nodeValue ) );
						$tree->addChild( $node );
						break;
					case XML_TEXT_NODE:
						if( strlen( trim( $content = $child->textContent ) ) )
						{
							return false;
						}
						else if( isset( $attributes['type'] ) && preg_match( "/.*ml/i", $attributes['type'] ) )
						{
							return false;
						}
						break;
					case XML_CDATA_SECTION_NODE:
						$tree->setContent( stripslashes( $child->textContent ) );
						break;
					default:
						break;
				}
				$child = $child->nextSibling;
			}
		}
		return true;
	}
protected function parseRecursive( $root, $tree )
	{
		$nodes = array();
		if( $child = $root->firstChild )
		{
			while( $child )
			{
				$attributes	= $child->hasAttributes()? $child->attributes : array();
				switch( $child->nodeType )
				{
					case XML_ELEMENT_NODE:
						$node = new XML_DOM_Node( $child->nodeName );
						if( !$this->parseRecursive( $child, $node ) )
						{
	#						$node->setContent( utf8_decode( $child->textContent ) );
							$node->setContent( $child->textContent );
						}
						foreach( $attributes as $attribute)
							$node->setAttribute( $attribute->nodeName, stripslashes( $attribute->nodeValue ) );
						$tree->addChild( $node );
						break;
					case XML_TEXT_NODE:
						if( strlen( trim( $content = $child->textContent ) ) )
						{
							return false;
						}
						else if( isset( $attributes['type'] ) && preg_match( "/.*ml/i", $attributes['type'] ) )
						{
							return false;
						}
						break;
					case XML_CDATA_SECTION_NODE:
						$tree->setContent( stripslashes( $child->textContent ) );
						break;
					default:
						break;
				}
				$child = $child->nextSibling;
			}
		}
		return true;
	}
protected function parseRecursive ( $ root , $ tree ) { $ nodes = array ( ) ; if ( $ child = $ root -> firstChild ) { while ( $ child ) { $ attributes = $ child -> hasAttributes ( ) ? $ child -> attributes : array ( ) ; switch ( $ child -> nodeType ) { case XML_ELEMENT_NODE : $ node = new XML_DOM_Node ( $ child -> nodeName ) ; if ( ! $ this -> parseRecursive ( $ child , $ node ) ) { #						$node->setContent( utf8_decode( $child->textContent ) );
 $ node -> setContent ( $ child -> textContent ) ; } foreach ( $ attributes as $ attribute ) $ node -> setAttribute ( $ attribute -> nodeName , stripslashes ( $ attribute -> nodeValue ) ) ; $ tree -> addChild ( $ node ) ; break ; case XML_TEXT_NODE : if ( strlen ( trim ( $ content = $ child -> textContent ) ) ) { return false ; } else if ( isset ( $ attributes [ 'type' ] ) && preg_match ( "/.*ml/i" , $ attributes [ 'type' ] ) ) { return false ; } break ; case XML_CDATA_SECTION_NODE : $ tree -> setContent ( stripslashes ( $ child -> textContent ) ) ; break ; default : break ; } $ child = $ child -> nextSibling ; } } return true ; }
Parses XML File to XML Tree recursive.
@access		protected
@param		DOMElement		$root		DOM Node Element
@param		XML_DOM_Node	$tree		Parent XML Node
@return		bool
Parses XML File to XML Tree recursive .