keithodulaigh.com Posted April 13, 2009 Share Posted April 13, 2009 Hi Everyone, I'm trying to parse the XML document that I've attached. The problem is the tags have : in their name, for example: <dc:title>bla bla bla</dc:title> Simple XML won't load the file without errors (it complains about some of the URLs in the document.) I've also tried the XML parser that I downloaded from here: http://www.criticaldevelopment.net/xml/doc.php (The download link is tucked away in the top left corner.) The above parser loads the document without error. To retrieve the value inside <dc:title>value</dc:title> would require me writing something like: $parser->document->...->dc:title[0]->tagData; which I can't do. Is there anyone who can point me in the right direction. Thanks in advance, Keith PS: I know I could use string replace to remove the : from the file but that's not desirable. The formatting of the document can't really be changed. It's the format used by Fedora Commons' Open Source Digital Repository. (http://www.fedora-commons.org/) [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/153900-solved-parsing-xml-with-in-tag-names/ Share on other sites More sharing options...
keithodulaigh.com Posted April 14, 2009 Author Share Posted April 14, 2009 It's okay now, I spoke to the author of that XML parser and he told me that when I want to access tags with : in them to just replace the : with _ and to write in lowercase. All is working now! Thanks. Link to comment https://forums.phpfreaks.com/topic/153900-solved-parsing-xml-with-in-tag-names/#findComment-809543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.