- From: Henry Zongaro <zongaro@ca.ibm.com>
- Date: Tue, 18 May 2004 16:58:45 -0400
- To: www-dom@w3.org
Hello. I was looking at the description of the XPathResult.iterateNext() method in the Working Group Note on DOM L3 XPath.[1] The description of that method indicates the following DOMException may be thrown: INVALID_STATE_ERR: The document has been mutated since the result was returned Similarly, the description of the invalidIteratorState attribute has this to say: Signifies that the iterator has become invalid. True if resultType is UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE and the document has been modified since this result was returned. Once the XPathResult.iterateNext() returns the value null, I think it would be better if the DOMException no longer had to be thrown on any subsequent calls to iterateNext(); similarly, once the iterateNext() method returns the value null, I think it be better if invalidIteratorState always returned True. Here's why: an obvious mechanism for implementing this sensitivity to mutation is for the implementation to register the XPathResult object to listen for DOM mutation events. However, once the iterateNext() method returns the last object, it's very unlikely that the XPathResult object will continue to be used. If all such "consumed" XPathResult objects that are created have to remain listening for DOM mutation events, just so they can set their invalidIteratorState attributes to True, it could prove very wasteful. Thanks, Henry [1] http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html#XPathResult-iterateNext [2] http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226/xpath.html#XPathResult-invalid-iterator-state ------------------------------------------------------------------ Henry Zongaro Xalan development IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044 mailto:zongaro@ca.ibm.com
Received on Tuesday, 18 May 2004 16:59:21 UTC