PHP SimpleXML, colon in tag name [closed]

DeadZonEf

New Member
I'm trying to read a large xml file (about 40 MB), and use this data for update the db of my application.It seems i've found a good compromise in terms of elapsed time/memory using XMLReader and simplexml_import_dom() but i can't get the value of attributes with colon in their name... for example \[code\]<g:attr_name>\[/code\].If i simply use $reader->read() function for each "product" node i can retrive the value as $reader->value, but if i expand() the node and copy it with $doc->importNode this attributes are ignored.\[code\] $reader = new XMLReader(); $reader->open(__XML_FILE__); $doc = new DOMDocument; while ($reader->read()) { switch ($reader->nodeType) { case (XMLREADER::ELEMENT): if($reader->localName=="product"){ $node = simplexml_import_dom($doc->importNode($reader->expand(), true)); echo $node->attr_name."<br><br>"; $reader->next('product'); } } }\[/code\]Probably i miss something... any advice would be really appriciated! Thanks.
 
Back
Top