Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Getting the prefix of a namespace knowing the URI

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Laurent Bihanic <laurent.bihanic AT atosorigin.com>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc: XOM-interest <XOM-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Getting the prefix of a namespace knowing the URI
  • Date: Mon, 17 Feb 2003 18:52:03 +0100


Elliotte Rusty Harold wrote:
The code to do this walking has to go somewhere, either in XOM or in your program. Since this is a very unusual thing to ask, I'd much rather the code went in your application than in XOM itself. The information will all be there, so you can get to it if you really need it. It's just going to take a little more effort to extract it.

Why is that unusual? Working with the URI alone and ignoring the prefix used in a document instance is just what XPath does and what XOM provides with getChildElement(name, uri).

So XOM (and XPath) provides me ways to access elements and attribute ignoring the namespace prefix used but to modify the document contents I have to either redeclare the namespace using an arbitrary (possibly conflicting) prefix or develop some low-level code to find the namespace declaration.

There should be a better way! (Maybe using XPath to look up namespace declaration in ancestor nodes. Any idea on how to do that?)

Laurent




Archive powered by MHonArc 2.6.24.

Top of Page