Index: branches/RC/core/units/general/xml_helper.php =================================================================== diff -u -N -r10458 -r11313 --- branches/RC/core/units/general/xml_helper.php (.../xml_helper.php) (revision 10458) +++ branches/RC/core/units/general/xml_helper.php (.../xml_helper.php) (revision 11313) @@ -101,26 +101,67 @@ } class kXMLNode { + /** + * Name of this node + * + * @var string + */ var $Name = null; + + /** + * Attributes of this node + * + * @var Array + */ var $Attributes = array(); + + /** + * List of node childnodes + * + * @var Array + */ var $Children = array(); + + /** + * Node content (usually text) + * + * @var string + */ var $Data = null; + /** + * First child of this node + * + * @var kXMLNode + */ var $firstChild = null; + + /** + * Last child of this node + * + * @var kXMLNode + */ var $lastChild = null; + /** * Parent node * * @var kXMLNode */ var $Parent = null; + /** * Node position relative to other nodes of it's parent * * @var int */ var $Position = 0; + /** + * Node identifier + * + * @var int + */ var $CRC = null; function kXMLNode($name, $attrs = array()) @@ -159,11 +200,22 @@ $a_child->SetParent($this); } + /** + * Appends data to current node + * + * @param string $data + */ function AppendData($data) { $this->Data .= $data; } + /** + * Returns child node by given path + * + * @param string $path + * @return kXMLNode + */ function &GetChild($path) { $entries = explode('/', strtoupper($path)); @@ -176,6 +228,12 @@ return $this->Children[$cur]->GetChild($left); } + /** + * Returns node value by given path + * + * @param string $path + * @return string + */ function GetChildValue($path) { $child =& $this->GetChild($path); @@ -184,6 +242,12 @@ } } + /** + * Returns child node by given position among it siblings + * + * @param int $position + * @return kXMLNode + */ function &GetChildByPosition($position) { if ($position < count($this->Children) ) { @@ -195,6 +259,12 @@ } } + /** + * Recursively searches for child with given name under current node + * + * @param string $name + * @return kXMLNode + */ function &FindChild($name) { $name = strtoupper($name); @@ -213,6 +283,13 @@ return $false; } + /** + * Retruns value of given child or value of it's attribute + * + * @param string $name + * @param string $attr + * @return string + */ function FindChildValue($name, $attr=null) { $child =& $this->FindChild($name);