Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ajt (2546)

  (email not shown publicly)

UK based. Perl, XML/HTTP, SAP, Debian hacker.

  • PerlMonks: ajt []
  • Local LUG: AdamTrickett []
  • Debian Administration: ajt []
  • LinkedIn: drajt []

Journal of ajt (2546)

Friday December 28, 2007
07:44 AM

XML on old Perls

[ #35225 ]

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...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • 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.
      • 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

        -- "It's not magic, it's work..."
  • 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).)

    • 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.

      -- "It's not magic, it's work..."