xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] New XPath issue: what to do with non-nodes?
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: Elliotte Harold <elharo AT metalab.unc.edu>
- Cc: John Cowan <cowan AT ccil.org>, xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] New XPath issue: what to do with non-nodes?
- Date: Thu, 13 Jan 2005 11:37:04 -0800
John Cowan wrote:
There is no problem in handling this pattern in a type-safe way.
You just need an XPathResult class with four extraction methods:
double doubleValue(), String stringValue(), boolean booleanValue(),
and Nodes nodelistValue().
Just for illustration: Nux has an interface "ResultSequence". Its intent corresponds to such an XPathResult class.
Currently it only has methods "Nodes toNodes()" (corresponding to nodeListValue()), and "Node next()" to get the next node of the sequence. I have left out methods doubleValue(), String stringValue(), boolean booleanValue() on ResultSequence because the same behaviour can be achieved via
ResultSequence results = xquery.execute(contextNode);
String s = results.next().getValue();
double d = Double.parseDouble(results.next().getValue())
boolean b = new Boolean(results.next().getValue()).booleanValue()
Nodes nodes = results.toNodes();
To me this seems only marginally more complex, so convenience methods for this (or slight variations on it) seemed to add more API complexity (and correspondingly obscure understanding) than they'd eliminate.
-
Re: [XOM-interest] New XPath issue: what to do with non-nodes?
, (continued)
-
Re: [XOM-interest] New XPath issue: what to do with non-nodes?,
Michael Abato, 01/13/2005
-
Re: [XOM-interest] New XPath issue: what to do with non-nodes?,
Elliotte Harold, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, John Cowan, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Bradley S. Huffman, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Elliotte Harold, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, John Cowan, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Elliotte Harold, 01/13/2005
- RE: [XOM-interest] New XPath issue: what to do with non-nodes?, Michael Kay, 01/13/2005
-
Re: [XOM-interest] New XPath issue: what to do with non-nodes?,
Elliotte Harold, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Elliotte Harold, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, John Cowan, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Wolfgang Hoschek, 01/13/2005
- RE: [XOM-interest] New XPath issue: what to do with non-nodes?, Michael Kay, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Wolfgang Hoschek, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Bradley S. Huffman, 01/17/2005
-
Re: [XOM-interest] New XPath issue: what to do with non-nodes?,
Michael Abato, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Michael Abato, 01/13/2005
- RE: [XOM-interest] New XPath issue: what to do with non-nodes?, Michael Kay, 01/13/2005
- Re: [XOM-interest] New XPath issue: what to do with non-nodes?, Elliotte Harold, 01/13/2005
Archive powered by MHonArc 2.6.24.