Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.2.8 released

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XOM 1.2.8 released
  • Date: Mon, 14 May 2012 10:54:56 -0700

On Mon, May 14, 2012 at 10:49 AM, Regier Avery J
<RegierAveryJ AT johndeere.com> wrote:

> I am trying to achieve a single xpath statement that works regardless of
> the namespace used.  This should be achievable (IMHO).  Even if you think
> it shouldn't be done, it's the wrong fix, since looking up the default
> namespace in the context should work.

Unprefixed names in XPath expressions are never (modulo bugs like the
one you were depending on) in any namespace.

You can have an XPath expression that works regardless of the
namespace, but it requires some ugly tricks like *:name and explicitly
querying the local-name() of nodes.

IN general, though, why would you want to do that? Outside of the true
ugliness of HTML/XHTML, I've never really seen a need for writing one
expression to apply regardless of namespaces. At one point over a
decade ago people were suggesting that namespaces should change with
each version of an XML vocabulary, which might have made this useful;
but it was soon realized that this was a very bad idea.

--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page