"lazy" handling of namespaces in XML::LibXML::Parser?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I am looking to change from using XML::DOM (old and busted)
to using XML::LibXML (new hotness).

At the moment, when handling the sprawling nightmare that
is AdsML, I exploit "namespace" processing provided by the underlying
Expat parser.

Quoting the docs:

"When this option is given with a true value, then the
parser does namespace processing. By default, namespace processing
is turned off. When it is turned on, the parser consumes
xmlns attributes and strips off prefixes from element
and attributes names where those prefixes have a defined namespace."

Since AdsML is (in practice) versbose and redundant, it is unambiguous
at the level of XPath's without needing to handle namespaces.

I would like to retain this pragmatic convenience.

But it appears that XML::LibXML, and XML::LibXML::Parser,
XML::LibXML::XPathContext are keen to force me to handle
namespaces explicitly, which is a workload I could well do without.

The parser is keen to retain namespaces, and XPath is keen
for me to name them all.

I have considered walking the DOM tree to set all the namespaces
of all the nodes to "default", but I suspect this would have performance

Any "shortcuts" would be welcomed.


Site Timeline