From: Per Nyfelt <per.nyfelt@re...> - 2004-07-16 09:38:02
torsdagen den 8 juli 2004 18.22 skrev rpbourret@...:
> Probably because an XPath query can return multiple nodes, so you need a
> ResourceSet, rather than a single object. (I'm not sure what XObject is.
> It's not listed in the JavaDocs for Xindice and the xmldb.org Web site is
> gone, so I can't look at the spec.)
You can get a list of nodes from the XPath query result in an XObject form:
NodeList nodeList = result.nodeset();
Web page is at:
I notices that I have not put the javadoc for the commons stuff on-line. I'll
fix this shortly.
Meanwhile, CVS sources is available at cvs.sourceforge.net:/cvsroot/xmldb-org
> -- Ron
> > does anyone know why XPathQueryService.queryResource(String id, String
> > query) is returning a ResourceSet? Would it not make more sense to return
> > a XObject (org.xmldb.common.xml.queries.XObject) instead?
> > i.e.change
> > ResourceSet queryResource( String id, String query ) throws
> > XMLDBException; to
> > XObject queryResource( String id, String query ) throws XMLDBException;
> > We are querying a single resource and are not expecting a result from any
> > other resource and certainly not a set of resources.
> > Returning an XObject makes it possible to handle xpaths that returns
> > numbers such as count() in a cleaner way than wrapping the result in XML
> > and turning it into a resource.
> > Actually why not use the same logic for collection scope queries and
> > change it from:
> > ResourceSet query( String query ) throws XMLDBException;
> > to
> > XObject query( String query ) throws XMLDBException;