Example #1
0
 function updateCollection($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $collection = new Collection();
     $collection->parseDomDocument($domDoc);
     $ret = $collection->updateRecord();
     return $ret;
 }
Example #2
0
 function parseDomDocument($domDoc)
 {
     $baseNode = $domDoc->document_element();
     if ($baseNode->has_child_nodes()) {
         $child = $baseNode->first_child();
         while ($child) {
             //if ($child->tagname=="Due") {
             if ($child->tagname) {
                 $tempXmlStr = $domDoc->dump_node($child);
                 $tempDomDoc = domxml_open_mem($tempXmlStr);
                 $collection = new Collection();
                 $collection->parseDomDocument($tempDomDoc);
                 $this->arrayList[] = $collection;
             }
             $child = $child->next_sibling();
         }
     }
     $this->setDomDocument();
     //$this->setDomDocumentRecords();
     return true;
 }
Example #3
0
 function parseDomDocument($domDoc)
 {
     $ret = true;
     $baseNode = $domDoc->document_element();
     if ($baseNode->has_child_nodes()) {
         $child = $baseNode->first_child();
         while ($child) {
             if ($child->tagname == "collectionArray") {
                 $collectionNode = $child->first_child();
                 while ($collectionNode) {
                     //if ($collectionNode->tagname=="collection") {
                     if ($collectionNode->tagname) {
                         $tempXmlStr = $domDoc->dump_node($collectionNode);
                         $tempDomDoc = domxml_open_mem($tempXmlStr);
                         $collection = new Collection();
                         $ret = $collection->parseDomDocument($tempDomDoc);
                         $this->setCollectionArray($collection);
                     }
                     $collectionNode = $collectionNode->next_sibling();
                 }
             } else {
                 //eval("\$this->".$child->tagname." = \"".$child->get_content()."\";");
                 // test varvars
                 $varvar = $child->tagname;
                 $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
                 $childContent = strtr(html_entity_decode($child->get_content()), $trans);
                 $this->{$varvar} = html_entity_decode($childContent);
                 //$this->$varvar = html_entity_decode($child->get_content());
             }
             //eval("\$this->set".ucfirst($child->tagname)."(\"".$child->get_content()."\");");
             $child = $child->next_sibling();
         }
     }
     $this->setDomDocument();
     return $ret;
 }