function processPairingData($xml) { $s1 = memory_get_usage(true); $return = new xmlCategory(); $r = simplexml_load_string($xml); $s2 = memory_get_usage(true); if ($r === false) { return false; } foreach ($r->children() as $child) { $name = $child->getName(); if ($name !== 'CATEGORY') { continue; } $id = (int) $child->CATEGORY_ID; //."<br />"; $txt = (string) $child->CATEGORY_NAME; //."<br />"; $new =& new xmlCategory($id, $txt); $return->addItem($new); //if ($child->hasChildren()) $this->recurseXml($child, $new); } return $return; }
function processPairingData($xml) { $s1 = memory_get_usage(true); $return = new xmlCategory(); $r = simplexml_load_string($xml); $s2 = memory_get_usage(true); if ($r === false) { return false; } foreach ($r->categories->children() as $child) { $id = (int) $child->attributes()->id; //."<br />"; $txt = (string) $child->attributes()->name; //."<br />"; $new =& new xmlCategory($id, $txt); $return->addItem($new); //if ($child->hasChildren()) $this->recurseXml($child, $new); } return $return; }