PHP Simple XML Parse Attributes
Posted
by jwzk
on Stack Overflow
See other posts from Stack Overflow
or by jwzk
Published on 2010-04-20T21:50:46Z
Indexed on
2010/04/20
21:53 UTC
Read the original article
Hit count: 230
I have an XML file with data stored like this:
<myxml>
<item name="column18">88744544</item>
<item name="column11">47884994</item>
<item name="column3">44788894</item>
</myxml>
I need to first check (and be sure that) column11 is defined (there is no particular order), and then get its value.
Using simple XML is not seeming to work too well.
I have the following, but the value is missing.
<?php
if (count($xml->myxml->item) > 0)
{
foreach ($xml->myxml->item as $item)
{
var_dump($item->attributes());
}
}
?>
© Stack Overflow or respective owner