diff --git a/livesupport/modules/storageServer/var/XmlParser.php b/livesupport/modules/storageServer/var/XmlParser.php index 5850e1eb7..78e15f9d1 100644 --- a/livesupport/modules/storageServer/var/XmlParser.php +++ b/livesupport/modules/storageServer/var/XmlParser.php @@ -1,4 +1,32 @@ stack, $el); } + /** * End tag handler * @@ -172,6 +202,7 @@ class XmlParser { $this->tree = $this->stack[0]; } } + /** * Character data handler * @@ -183,6 +214,7 @@ class XmlParser { $cnt = count($this->stack); if(trim($data)!=''){ $this->stack[$cnt-1]->content .= $data; } } + /** * Default handler * @@ -199,6 +231,7 @@ class XmlParser { $this->stack[$cnt-1]->content .= "*** $data ***"; //} } + /** * Return result tree * @@ -207,6 +240,7 @@ class XmlParser { function getTree(){ return $this->tree; } + /** * Return error string * @@ -215,6 +249,7 @@ class XmlParser { function isError(){ return $this->err[0]; } + /** * Return error string * @@ -223,14 +258,8 @@ class XmlParser { function getError(){ return $this->err[1]; } - /** - * Debug dump of tree - * - * @return hash, tree structure - */ - function dump(){ - var_dump($this->tree); - } + + /* ----------------------------------- auxiliary methos for serialization */ /** * Serialize metadata of one file * @@ -242,6 +271,7 @@ class XmlParser { $res .= "\n"; return $res; } + /** * Serialize one metadata element * @@ -265,51 +295,16 @@ class XmlParser { $res .= ""; return $res; } -} -/* -class md{ - var $tree = NULL; - function md(&$tree){ - $this->tree =& $tree; - } - function store(){ - $this->storeNode($this->tree); - } - function storeNode($node, $parid=NULL, $nameSpaces=array()){ - $nameSpaces = array_merge($nameSpaces, $node->nSpaces); - $subjns = (is_null($parid)? '_G' : '_I'); - $subject = (is_null($parid)? 'this->gunid' : $parid); - $id = $this->storeRecord($subjns, $subject, - "{$node->ns}/{$nameSpaces[$node->ns]}", $node->name, 'T', '_blank', NULL); -# $node->ns, $node->name, 'T', '_blank', NULL); - foreach($node->attrs as $atn=>$ato){ - $this->storeRecord('_I', $id, - "{$ato->ns}/{$nameSpaces[$ato->ns]}", $ato->name, 'A', '_L', $ato->val); -# $ato->ns, $ato->name, 'A', '_L', $ato->val); - } - foreach($node->children as $ch){ - $this->storeNode($ch, $id, $nameSpaces); - } - } - function storeRecord($subjns, $subject, - $predns, $predicate, $predxml='T', $objns=NULL, $object=NULL){ - $id = $GLOBALS['i']++; - $res = "$id, ". - "$subjns, $subject, ". - "$predns, $predicate, $predxml, ". - "$objns, $object". - "\n"; - echo $res; - return $id; - } -} -$file = "ex3.xml"; -$p =& new XmlParser(file_get_contents($file)); -#echo $p->serialize(); -#echo $p->dump(); -$tree = $p->getTree(); -$md = new md($tree); -$md->store(); -*/ + /* -------------------------------------------------------- debug methods */ + /** + * Debug dump of tree + * + * @return hash, tree structure + */ + function dump(){ + var_dump($this->tree); + } + +} ?> \ No newline at end of file