PHP Hyphen/Minus issue with XML
Posted: Thu Dec 11, 2008 9:50 am
Ok, I am not new to php but I have not had to work on XML very often. Now I have been given an XML file that I am trying to parse using simple XML. Everything was going fine until i realized that the XML file feed (which I have no control over) uses hyphens and periods in there XML tagnames... for instance here is a snippet...
<docdata management-status="embargoed">
<!-- The unique ID of this document -->
<doc-id id-string="hid27373sect_cd7cf98e7d3206108f6c0e0044af2451"/>
−
<!--
Release date and time are used for determining when an article will appear active
-->
<date.release norm="20080814T000000"/>
−
<!--
Expiration date and time are used for determining when an article will archive
-->
<date.expire norm="20080821T093000"/>
<!-- Keywords are used for tagging articles -->
−
<key-list>
<keyword key="Ligonier"/>
<keyword key="West Noble"/>
</key-list>
</docdata>
I can't seem to figure out how to access these tags using simplexml as PHP craps out when it hits the hyphen and period... ??? What am I missing? Thanks for any help in advance.
<docdata management-status="embargoed">
<!-- The unique ID of this document -->
<doc-id id-string="hid27373sect_cd7cf98e7d3206108f6c0e0044af2451"/>
−
<!--
Release date and time are used for determining when an article will appear active
-->
<date.release norm="20080814T000000"/>
−
<!--
Expiration date and time are used for determining when an article will archive
-->
<date.expire norm="20080821T093000"/>
<!-- Keywords are used for tagging articles -->
−
<key-list>
<keyword key="Ligonier"/>
<keyword key="West Noble"/>
</key-list>
</docdata>
I can't seem to figure out how to access these tags using simplexml as PHP craps out when it hits the hyphen and period... ??? What am I missing? Thanks for any help in advance.