Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.1: XPath

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <jcowan AT reutershealth.com>
  • To: "Bradley S. Huffman" <hip AT a.cs.okstate.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.1: XPath
  • Date: Wed, 12 Jan 2005 13:12:52 -0500

Bradley S. Huffman scripsit:

> But if it's a subclass of ParentNode, it's also a subclass of Node, so I
> can detach it and try to re-insert it someplace else, which means the
> core class are going to have to compensate for this special class. Sounds
> real messy.

Well, presumably this just falls out from the existing implementation of the
add-a-child methods, which already have to make this check and throw
IllegalAddException.

> Or drop the restriction that a query return only a instances of Nodes and
> allow it to return a instance of Boolean, String, or Node,

Recte: Boolean, String, Double, or Nodes (not Node). And since Java doesn't
do
overloading based on result type, this would involve a new union class.

> then have a wrapper
> class that *is not* a instance of any XOM core class that wraps Text nodes
> on
> input and let it pass right though to the result.

But the Nodes class would have to be able to hold this wrapper, so that an
XPath that returns (say) three element nodes and two text nodes can return
five Nodes: three instances of Element and two of TextWrapper. Once you do
that,
you might as well make TextWrapper a subchild of ParentNode and have done
(see above).

> public interface TextSequence {

Why an interface?

--
John Cowan jcowan AT reutershealth.com www.reutershealth.com
www.ccil.org/~cowan
I come from under the hill, and under the hills and over the hills my paths
led. And through the air. I am he that walks unseen. I am the clue-finder,
the web-cutter, the stinging fly. I was chosen for the lucky number. --Bilbo




Archive powered by MHonArc 2.6.24.

Top of Page