src/XML/Converter.php
protected static function convertToObjectRecursive( $node, $object )
	{
		$object->children	= new stdClass();
		$object->attributes	= new stdClass();
		foreach( $node->getChildren() as $childNode )
		{
			$childObject	= new stdClass();
			$nodeName		= $childNode->getNodeName();
			$object->children->$nodeName	= $childObject;
			self::convertToObjectRecursive( $childNode, $childObject );
		}
		if( $node->getAttributes() )
		{
			foreach( $node->getAttributes() as $key => $value )
				$object->attributes->$key	= $value;
		}
		$object->content = $node->getContent();
	}
protected static function convertToObjectRecursive( $node, $object )
	{
		$object->children	= new stdClass();
		$object->attributes	= new stdClass();
		foreach( $node->getChildren() as $childNode )
		{
			$childObject	= new stdClass();
			$nodeName		= $childNode->getNodeName();
			$object->children->$nodeName	= $childObject;
			self::convertToObjectRecursive( $childNode, $childObject );
		}
		if( $node->getAttributes() )
		{
			foreach( $node->getAttributes() as $key => $value )
				$object->attributes->$key	= $value;
		}
		$object->content = $node->getContent();
	}
protected static function convertToObjectRecursive ( $ node , $ object ) { $ object -> children = new stdClass ( ) ; $ object -> attributes = new stdClass ( ) ; foreach ( $ node -> getChildren ( ) as $ childNode ) { $ childObject = new stdClass ( ) ; $ nodeName = $ childNode -> getNodeName ( ) ; $ object -> children -> $ nodeName = $ childObject ; self :: convertToObjectRecursive ( $ childNode , $ childObject ) ; } if ( $ node -> getAttributes ( ) ) { foreach ( $ node -> getAttributes ( ) as $ key => $ value ) $ object -> attributes -> $ key = $ value ; } $ object -> content = $ node -> getContent ( ) ; }
Converts DOM node to tree of objects recursively and in-situ.
@static
@access		protected
@param		DOMNode		$node		DOM node to convert
@param		object		$object		Tree for objects
@return		void
Converts DOM node to tree of objects recursively and in - situ .