Skip to Content.
Sympa Menu

xom-interest - RE: [XOM-interest] Sparta: similar to XOM.

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "O'Brien-Strain, Eamonn" <eob AT exch.hpl.hp.com>
  • To: "'Elliotte Rusty Harold'" <elharo AT metalab.unc.edu>
  • Cc: "'xom-interest AT lists.ibiblio.org'" <xom-interest AT lists.ibiblio.org>
  • Subject: RE: [XOM-interest] Sparta: similar to XOM.
  • Date: Sun, 29 Sep 2002 14:11:43 -0700

> -----Original Message-----
> From: Elliotte Rusty Harold [mailto:elharo AT metalab.unc.edu]
[...]
> 2. I saw that when XPath was eventually added, an Attribute node
> class would be necessary. What does Sparta do when someone passes it
> an XPath that selects an Attribute node or nodes?

In the Sparta XPath subset it is possible to statically determine, just by
parsing the XPath expression, whether it selects an element or a string.
There are different xpathSelect*() methods for returning Elements and
Strings. For example:

Element foo = doc.xpathSelectElement( "/Top[@g='ggg']/Foo[4]" );
String bar = doc.xpathSelectString( "/Top[@g='ggg']/Foo[4]/@bar" );

There are also versions that return iterators over Elements or Strings -- in
the case of multiple matches the above methods return the first match.

The methods throw an exception when the wrong type of XPath is passed to them.

__
Eamonn




Archive powered by MHonArc 2.6.24.

Top of Page