Answer the question
In order to leave comments, you need to log in
How to write an XML parser with attributes?
Hello colleagues. There is a list of XML files. I load a file with the SIMPLEXML_LOAD_FILE command.
I can't parse a file that contains:
<?xml version="1.0" encoding="utf-8"?><Report layerType="OldCompatible" version="2"><cp dn="2" dt="4" dcd="08.11.2013 15:28:15" l="1" /><dp page_count="000002" det_add_col="true" det_show_nds="true" det_add_accums="false" det_add_limit="false" det_add_GMT="true" det_add_max_lim="false" det_add_rule="false" /><b sd="12.05.2013" ed="08.11.2013" /><ds n="70655" sim="89000844" pt="Абонентский номер" t="11,1049" f="13,1040" cn="руб." sd="12.05.2013" ed="08.11.2013"><i d="15.05.2013 12:19:40" n="+78055" zp="" zv="" s="Телеф." a="" du="0:56" c="0,7594" g="b" dup="0:56" f="0,8961" bd="15.05.2013 12:22:20" cur="810" gmt="+04:00" /><i d="15.05.2013 12:19:40" n="<--7403581" zp="" zv="" s="Телеф." a="" du="0:56" c="0" g="i" dup="0:56" f="0" bd="15.05.2013 12:22:20" cur="810" gmt="+04:00" />
foreach ($xml->i[0]->attributes() as $k =>$v)
echo (string)$k."=".(string)$v."\r\n";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question