Hi Ilene,
I just updated my xalan workspace and saw this prototype. Actually I am
also implementing similar (DOM L3 XPATH API) prototype and intend it to go
to org.apache.xerces.dom workspace.
I have not gone thru all the interfaces. So I dont have all the feedback
but I have a question about XPathResult.getInvalidIteratorState()
method...
In XPathResult.getInvalidIteratorState() implementation, its assuming the
doc being event target. but it may not be necessary as per DOM L3 XPATH
interface DOM L2 Core is the only mandatory requirement for DOM XPATH
implementation. So what would be other way to find out if the document is
modified to mark the iterator state invalid?
what does the community feels about DOM L3 XPATH being in xerces or in
xalan or both.
Either this prototype can become part of xercesImpl.jar or we do one for
xerces.
Problem with former would be DTM layer, XPathEvaluator being part of
document (but I think its ok, as XPathEvaluator implementation can come
from outside). I see references of DTM in XPathExpression.evaluate()
method.
IMO, I prefer latter which is DOM L3 XPATH being part of xerces. Here
XPathEvaluator is implemented by the document and works directly on the
DOM tree.
Comments?
-vivek.
On Fri, 20 Sep 2002 [EMAIL PROTECTED] wrote:
> Hi,
>
> I have just committed, to xml-xalan, a prototype implementation of the DOM
> L3 XPath Specification.
>
> The interfaces org.w3c.dom.xpath.* are being picked up from xercesImpl.jar.
> The implementing classes can be found in the org.apache.xpath.domapi
> package. One possible usage would be as follows. There are other
> variations, such as using the evaluate method on XPathExpression instead of
> XPathEvaluator. (I hope the formatting isn't too terrible...)
>
> // Set up a DOM tree to query.
> InputSource in = new InputSource(new FileInputStream(filename));
> DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance
> ();
> dfactory.setNamespaceAware(true);
>
> Document doc = dfactory.newDocumentBuilder().parse(in);
>
> // some xpath expression
> String xpath = "/";
>
> // pass the document to the XPathEvaluatorImpl constructor to
> parallel the case where XPathEvaluator was obtained by casting a document.
> XPathEvaluator xpathEvaluator = new
> org.apache.xpath.domapi.XPathEvaluatorImpl(doc);
> XPathResult result = (XPathResult)xpathEvaluator.evaluate(xpath, doc,
> xpathEvaluator.createNSResolver(doc),
> XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
>
> Node n;
> int j = 0;
> while (j < result.getSnapshotLength())
> {
> n = result.snapshotItem(j++);
> // do something with node
> }
>
>
> The XPathNamespace node interface has not been implemented (yet?)
> Otherwise, it should be reasonably conformant, but it still needs work. I
> welcome feedback!
>
>
> Ilene Seelemann.
> ------
> IBM Toronto Lab
> Internet: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Vivek Pandey
XML & Webservices
Sun Microsystems, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]