ibneko: (Default)
Using XML::LibXML::Reader:

code )

Resulting text output: )

While, yes, this doesn't actually do what I need it to do, it gives me the ways I need to access everything in the xml file without doing any manual parsing on my own. Finally. There's a stupid lack of documentation out there, although I get the impression now (well, 30 minutes ago) that it's because the function names are supposed to be a set standard that is presumed to be already known...

But still, HAH! It WORKS!

Now for the more tedious but easier part of uh, figuring out which parts of what goes where in the database.

Oh, yeah, the code's here mostly to help anyone who might be googling for stuff.
Problems I ran into:
- Why doesn't the XML::LibXML::Reader work? (creating a new Reader with a string throws an error)
Answer: because I was running LibXML 2.5 on MacOS X.
- How do I access the attributes / How do I get the attribute names / How do I figure out which attributes there are?
Answer: Tricky bastard requires use of moveToFirstAttribute() first. Then name() and value() will snag the proper attributes. moveToAttributeNo( number ) will move you to the number-th attribute. They do not appear to be in any particular order, so assumptions should not be made about which one would be first, which would be second, etc.
- Which module should I use?
Answer: I don't know. See http://perl-xml.sourceforge.net/faq/#dont_parse. I hope I made the right choice with XML::LibXML::Reader............ ::crosses fingers and toes::

Expand Cut Tags

No cut tags

Profile

ibneko: (Default)
ibneko

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Page generated Jun. 25th, 2017 10:26 am
Powered by Dreamwidth Studios
November 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2016