public function toXML ($attributes = FALSE)
	{
		
		// Set class name for the elements
		// Remove the Sonic\Model prefix and convert namespace \ to _
		
		$class	= str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
		
		// Create DOMDocument

		$doc	= new \DOMDocument ('1.0', 'UTF-8');
		
		// Create root node
		
		$node	= $doc->createElement ($class);
		$doc->appendChild ($node);
		
		// Get array
		
		$arr	= $this->toArray ($attributes);
		
		// Set each attribute

		foreach ($arr as $name => $val)
		{
			$node->appendChild ($doc->createElement (strtolower ($name), htmlentities ($val)));
		}
		
		// Return doc
		
		return $doc;
		
	}
public function toXML ($attributes = FALSE)
	{
		
		// Set class name for the elements
		// Remove the Sonic\Model prefix and convert namespace \ to _
		
		$class	= str_replace ('\\', '_', str_replace ('sonic\\model\\', '', strtolower (get_called_class ())));
		
		// Create DOMDocument

		$doc	= new \DOMDocument ('1.0', 'UTF-8');
		
		// Create root node
		
		$node	= $doc->createElement ($class);
		$doc->appendChild ($node);
		
		// Get array
		
		$arr	= $this->toArray ($attributes);
		
		// Set each attribute

		foreach ($arr as $name => $val)
		{
			$node->appendChild ($doc->createElement (strtolower ($name), htmlentities ($val)));
		}
		
		// Return doc
		
		return $doc;
		
	}
public function toXML ( $ attributes = FALSE ) { // Set class name for the elements // Remove the Sonic\Model prefix and convert namespace \ to _ $ class = str_replace ( '\\' , '_' , str_replace ( 'sonic\\model\\' , '' , strtolower ( get_called_class ( ) ) ) ) ; // Create DOMDocument $ doc = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; // Create root node $ node = $ doc -> createElement ( $ class ) ; $ doc -> appendChild ( $ node ) ; // Get array $ arr = $ this -> toArray ( $ attributes ) ; // Set each attribute foreach ( $ arr as $ name => $ val ) { $ node -> appendChild ( $ doc -> createElement ( strtolower ( $ name ) , htmlentities ( $ val ) ) ) ; } // Return doc return $ doc ; }
Return a DOM tree with object attributes
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@return \DOMDocument|boolean
Return a DOM tree with object attributes