XML on old Perls

ajt on 2007-12-28T12:44:44

I'm working on parsing the XML files output by a UPS WorldShip client application. It looked straight forward, just pass in a bunch of XPATHs and out comes a bunch of values...

The problem is that the stupid XML file from UPS comes in a non-named namespace and the old version of Perl and LibXML I'm using can't get at the xpath I want. Apparently it is easy to fix, but it requires a newer version of XML::LibXML, which won't install on this antique box.

Argh.....! I could use the older XML::XPath which is slower and less standard compliant so it just blunders on ignoring the namespace, so it works, even though it's the wrong thing to do. Or I could just hack the XML that the stupid UPS WorldShip system outputs...


XML::LibXML::XPathContext

Dom2 on 2008-01-07T08:18:34

Grab an old copy of XML::LibXML::XPathContext from backpan. It should work OK. Newer versions got folded into XML::LibXML, but these are separate.

Re:XML::LibXML::XPathContext

Aristotle on 2008-01-07T09:48:56

No need for BackPAN even.

Re:XML::LibXML::XPathContext

ajt on 2008-01-07T11:14:33

Does not work, my libxml is too old, so I'm stuck with an old XML::LibXML, which means it won't load. Which is exactly what I tried in the first place.

I really like XML::LibXML, the only problem I have with it is installing it on old Red Hat boxes. The antique Red Hat Linux boxes at work are really getting long in the tooth and maintaining them is becoming a real pain in the posterior. It doesn't look like the recent binary rpms of libxml will install either, the installed glibc is too old.

Thankfully I don't have any problems on my Debian boxes at home, which are up to date. Binary debs may not be perfect but they are easier to deal with than antique Red Hat systems*.

* Modern Red Hat systems may or may not be easy to deal with, ours are antiques.

Terminology

Aristotle on 2008-01-07T10:27:15

The “un-named namespace” is properly called the “default namespace.” The thing that you’d call the “name” of a namespace is called the “prefix.”

The prefix has no meaning whatsoever in terms of processing; the only thing that matters is the name of an element and the URI of its namespace.

(Just a few pointers, so you can better follow what other people say and other people can more easily follow what you say (assuming you use the right lingo).)

Re:Terminology

ajt on 2008-01-07T14:11:22

At the end of a long and frustrating morning, after not having worked with XML for a long while it's easy to screw up. You are correct though, using the correct terminology makes like easier for everyone.