Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] adding NamespaceContext.getNamespaces()

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: Elliotte Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] adding NamespaceContext.getNamespaces()
  • Date: Tue, 31 Oct 2006 10:18:46 -0800


On Oct 31, 2006, at 10:03 AM, Elliotte Harold wrote:

Wolfgang Hoschek wrote:
I'd really love to reuse nu.xom.XPathContext for XQuery, but to do so realistically one needs a way to get hold of the entire set of stored namespace declarations. For simplicity, I'd advocate to add a single corresponding method to XPathContext:

Not out of the question, but I don't like exposing raw collections classes like map in XOM's API. What's the use case? i.e. what code do you want to write that you can't write now? Would there be another way to do this that simply involved adding a more strongly- typed method or two to XPathContext?

The use case was already given in the previous message: The XQuery analog for Steve's message.xpath("muws-p2-xs:StateTransition/*", catalog) would be XQueryUtil.xquery("muws-p2-xs:StateTransition/*", catalog). The way the saxon binding works is to predeclare all ns declarations on XQuery setup, rather than via a lookup(String) callback, as in Jaxen or JAXP. That's why I'd need something like getNamespaces() rather than lookup(String).

If you'd rather like to expose the namespace map in a strongly typed manner, fine. For example via getNamespaceCount(), getNamespacePrefix (int), getNamespaceURI(int). It would mean more complexity than the single method I proposed, so would mean more effort and change on your part, which is what I'm trying to minimize in RFEs.

Wolfgang.




Archive powered by MHonArc 2.6.24.

Top of Page