W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2004

DOM L3 XPath: effect of mutation after iterator exhausted?

From: Henry Zongaro <zongaro@ca.ibm.com>
Date: Tue, 18 May 2004 16:58:45 -0400
To: www-dom@w3.org
Message-ID: <OF3206EA2C.1810F1DD-ON85256E98.0070D6E4-85256E98.00733DF6@ca.ibm.com>


     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 

Similarly, the description of the invalidIteratorState attribute has this 
to say:

  Signifies that the iterator has become invalid. True if resultType
  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 



Henry Zongaro      Xalan development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
Received on Tuesday, 18 May 2004 16:59:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:12 UTC