src/XML/DOM/Builder.php
static public function build( XML_DOM_Node $tree, $encoding = "utf-8", $namespaces = array() )
	{
		$document	= new DOMDocument( "1.0", $encoding );
		$document->formatOutput = TRUE;
		$root		= $document->createElement( $tree->getNodename() );
		foreach( $namespaces as $prefix => $namespace )
			$root->setAttribute( "xmlns:".$prefix, $namespace );
		$root		= $document->appendChild( $root );
		self::buildRecursive( $document, $root, $tree, $encoding );
		return $document->saveXML();
	}
static public function build( XML_DOM_Node $tree, $encoding = "utf-8", $namespaces = array() )
	{
		$document	= new DOMDocument( "1.0", $encoding );
		$document->formatOutput = TRUE;
		$root		= $document->createElement( $tree->getNodename() );
		foreach( $namespaces as $prefix => $namespace )
			$root->setAttribute( "xmlns:".$prefix, $namespace );
		$root		= $document->appendChild( $root );
		self::buildRecursive( $document, $root, $tree, $encoding );
		return $document->saveXML();
	}
static public function build ( XML_DOM_Node $ tree , $ encoding = "utf-8" , $ namespaces = array ( ) ) { $ document = new DOMDocument ( "1.0" , $ encoding ) ; $ document -> formatOutput = TRUE ; $ root = $ document -> createElement ( $ tree -> getNodename ( ) ) ; foreach ( $ namespaces as $ prefix => $ namespace ) $ root -> setAttribute ( "xmlns:" . $ prefix , $ namespace ) ; $ root = $ document -> appendChild ( $ root ) ; self :: buildRecursive ( $ document , $ root , $ tree , $ encoding ) ; return $ document -> saveXML ( ) ; }
Builds XML and returns XML as string.
@static
@access		public
@param		XML_DOM_Node	$tree			XML Tree
@param		string			$encoding		Encoding Character Set (utf-8 etc.)
@return		string							Rendered tree as XML string
Builds XML and returns XML as string .