Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Dear Monks,
I have a bunch of XML files from my GPS, and I'd like to extract data from them, and play around with them, displaying them graphically for one. As it's done properly, it has its own schema, and uses its own namespace. One such file can be found at www.dehulst.nl/Garmin/TCX/1832.tcx So, in order to parse such an XML file, you have to register it with XML::LibXML (using a variable $string as the prefix) Now, extracting the value of an attribute poses no problem: Just in case anyone is worried, there (usually) is only one Lap per file. The problems start when I want to extract the timestamps from each recorded datapoint. My first try was This fails. It does find the set of nodes, but fails to find the timestamp that's in the Time element. Experimenting with the examples I Googled, I found the following, which does give me the timestamps: That's nasty. It does work, but it's nasty. So, the question is: why does the findvalue function fail to work with a non-default namespace? Or am I missing something? In reply to XML::LibXML and namespaces by Anonymous Monk
|
|