src/XML/DOM/Parser.php
public function parse( $xml )
	{
		$this->loadXml( $xml );
		$root	= $this->document->firstChild;
		while( $root->nodeType == XML_COMMENT_NODE )
			$root	= $root->nextSibling;

		$tree	= new XML_DOM_Node( $root->nodeName );
		if( $root->hasAttributes())
		{
			$attributeNodes	= $root->attributes;
			foreach( $attributeNodes as $attributeNode )
				$tree->setAttribute( $attributeNode->nodeName, $attributeNode->nodeValue );
		}
		$this->parseRecursive( $root, $tree );
		return $tree;
	}
public function parse( $xml )
	{
		$this->loadXml( $xml );
		$root	= $this->document->firstChild;
		while( $root->nodeType == XML_COMMENT_NODE )
			$root	= $root->nextSibling;

		$tree	= new XML_DOM_Node( $root->nodeName );
		if( $root->hasAttributes())
		{
			$attributeNodes	= $root->attributes;
			foreach( $attributeNodes as $attributeNode )
				$tree->setAttribute( $attributeNode->nodeName, $attributeNode->nodeValue );
		}
		$this->parseRecursive( $root, $tree );
		return $tree;
	}
public function parse ( $ xml ) { $ this -> loadXml ( $ xml ) ; $ root = $ this -> document -> firstChild ; while ( $ root -> nodeType == XML_COMMENT_NODE ) $ root = $ root -> nextSibling ; $ tree = new XML_DOM_Node ( $ root -> nodeName ) ; if ( $ root -> hasAttributes ( ) ) { $ attributeNodes = $ root -> attributes ; foreach ( $ attributeNodes as $ attributeNode ) $ tree -> setAttribute ( $ attributeNode -> nodeName , $ attributeNode -> nodeValue ) ; } $ this -> parseRecursive ( $ root , $ tree ) ; return $ tree ; }
Parses XML String to XML Tree.
@access		public
@param		string		$xml			XML to parse
@return		XML_DOM_Node
Parses XML String to XML Tree .