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: Regier Avery J <RegierAveryJ AT JohnDeere.com>
  • 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 12:49:24 -0500

This is a non-null namespace associated with the whole document, which is
unprefixed at the start. See the test document.

Document doc = new Builder().build(new StringReader("<hi
xmlns='there://mr.space/alien'/>"));
XPathContext context =
XPathContext.makeNamespaceContext(doc.getRootElement());
context.addNamespace("a", context.lookup(""));
Nodes query = doc.query("//*[not(self::a:human)]", context);

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.

Avery J. Regier
IVS Solutions Infrastructure Technical Architect
Work: 515 331-9905 / Cell: 309 781-1366
RegierAveryJ AT JohnDeere.com


-----Original Message-----
From: xom-interest-bounces AT lists.ibiblio.org
[mailto:xom-interest-bounces AT lists.ibiblio.org] On Behalf Of Michael Kay
Sent: Monday, May 14, 2012 10:11 AM
To: xom-interest AT lists.ibiblio.org
Subject: Re: [XOM-interest] XOM 1.2.8 released



On 14/05/2012 15:44, Regier Avery J wrote:
> This release resulted in a surprising failure for me. I've been
> successfully giving a prefix to the default namespace of a document using:
>
> XPathContext context =
> XPathContext.makeNamespaceContext(doc.getRootElement());
> context.addNamespace("a", context.lookup(""));

It looks as if a bug has been fixed. It should not be possible to bind a
prefix to the "null namespace".


Michael Kay
Saxonica
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest




Archive powered by MHonArc 2.6.24.

Top of Page