PHP library for parsing XML with a colons in tag names? [duplicate]

Say you have some xml like this.

<xhtml:div>
  <xhtml:em>italic</xhtml:em>
  <date>2010-02-01 06:00</date>
</xhtml:div>

You can access ’em’ like this: $xml->children('xhtml', true)->div->em;

however, if you want the date field, this: $xml->children('xhtml', true)->div->date; wont work, because you are stuck in the xhtml namespace.

you must execute ‘children’ again to get back to the default namespace:

$xml->children('xhtml', true)->div->children()->date;

Leave a Comment