Dare Obasanjo wrote: > > From the point of view of an implementor the XPathService returns Resources > within ResourceSets and this is way too coarse grained. In fact I feel the > concept of making ResourceSets the return value of XPath queries is a bad idea > for a few reasons > > 1.) It is inconsistent with standard XPath. > 2.) It is confusing to novice developers. > 3.) Very rarely is a user simply interested in just the documents that match > the query but in the actual nodes even for queries that return node lists.
There is no reason that a "Resource" need be equated with a "Document", so I disagree with the point about this being too 'coarse grained'. But you bring up a good point that the result set of an XPath query need not always be XML. A solution to this issue might be to define a 'simple type' Resource (this is along the lines of how the DOM defines nodes with a type flag) e.g. something like the interface interface SimpleTypeResource extends Resource { const STRING_TYPE = 1; const INTEGER_TYPE = 2; const FLOAT_TYPE = 3; const DATE_TYPE = 4; int getType(); String getString(); void setString(); Integer getInteger() throws cast... Date getDate(); ... } This interface would roughly encapsulate the XML Scheme predefined simple types. When an XPath query returns a ResourceSet, one could inspect each of the resources to see whether they are an XMLResource, BinaryResource, or SimpleTypeResource. Jonathan ---------------------------------------------------------------------- Post a message: mailto:[EMAIL PROTECTED] Unsubscribe: mailto:[EMAIL PROTECTED] Contact administrator: mailto:[EMAIL PROTECTED] Read archived messages: http://archive.xmldb.org/ ----------------------------------------------------------------------