Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XPath Namespace Nodes rethink

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XPath Namespace Nodes rethink
  • Date: Sun, 23 Jan 2005 10:09:22 -0500

Elliotte Harold wrote:

My suspicion is that the proposed XPathNamespaceNode is *not* a subclass of nu.xom.Node. A lot of code would need to be reconsidered if I were to add an additional base node type.

There's a problem with this. The Nodes object returned by query can't contain a non-Node (or rather it can, but the call to get() for that node would throw a ClassCastException). Options

1. Just make XPathNamespaceNode a subclass of Node.
2. Wrap the namespace node in something that can be returned, like an Element in a particular namespace.
3. Just make the query method return a List instead of a Nodes
4. Add an additional query method, probably in a separate package, that does return a List.

I don't like any of these solutions. 2 and 4, however, seem the least ugly.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page