Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Xpath parsing problem

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Peter Murray-Rust <pm286 AT cam.ac.uk>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Xpath parsing problem
  • Date: Thu, 3 Mar 2011 15:36:42 +0000

On Thu, Mar 3, 2011 at 3:24 PM, Mike Miller <mm8041 AT gmail.com> wrote:

> See, life could be Simple ;-) But if I want it to be, I now need to
> configure XOM
> with another XPATH engine, which results in more challenges. I just want
> my
>
>
You don't *have* to move to XPath2.0. By using XPathContext
http://www.xom.nu/apidocs/nu/xom/XPathContext.html you can choose a prefix
that binds your namespace to a prefix of your choice.


> document data, is that too much to ask ;-)
>
> You *have* to understand what the namespaces in your document are. You
don't give details on the "crap" but I guess it includes

xmlns=""

which assigns the default namespace to nodes in /a/b/c

or xmlns="http://foo.org";

which binds a specific namespace to it

By using XPathContext you can create an explicit prefix bound to the
namespace and include it in your XPath. Alternatively and I think simpler
you can use local-name() which will do the same as the * in XPath 2.0





--
Peter Murray-Rust
Reader in Molecular Informatics
Unilever Centre, Dep. Of Chemistry
University of Cambridge
CB2 1EW, UK
+44-1223-763069




Archive powered by MHonArc 2.6.24.

Top of Page