Dealing with Namespace/Colon in SimpleXML
| From: | Andrew Darby | Date: | Fri, 26 Oct 2007 19:56:03 +0000 |
| Subject: | Dealing with Namespace/Colon in SimpleXML | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-44270@lists.php.net to get a copy of this message | ||
Hello, all. I'm trying to use SimpleXML to loop through an .xml file,
but when I try to do the following, it chokes on the colon:
foreach ($xml_data->dc:title as $item) {
[do whatever here]
}
The element in the XML has a colon in it, i.e.,
<dc:title>Interesting Book</dc:title>
Anybody know how to deal with this? I must be missing something obvious.
Thanks,
A.