/[classpath]/classpath/gnu/xml/dom/html2/DomHTMLCollection.java
ViewVC logotype

Diff of /classpath/gnu/xml/dom/html2/DomHTMLCollection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dog, Wed Mar 9 21:59:33 2005 UTC revision 1.2 by dog, Sat Mar 12 19:53:26 2005 UTC
# Line 37  exception statement from your version. * Line 37  exception statement from your version. *
37    
38  package gnu.xml.dom.html2;  package gnu.xml.dom.html2;
39    
40    import gnu.xml.dom.DomDOMException;
41  import gnu.xml.dom.DomElement;  import gnu.xml.dom.DomElement;
42  import java.util.ArrayList;  import java.util.ArrayList;
43  import java.util.Iterator;  import java.util.Iterator;
44  import java.util.LinkedList;  import java.util.LinkedList;
45  import java.util.List;  import java.util.List;
46    import org.w3c.dom.DOMException;
47  import org.w3c.dom.NamedNodeMap;  import org.w3c.dom.NamedNodeMap;
48  import org.w3c.dom.Node;  import org.w3c.dom.Node;
49  import org.w3c.dom.NodeList;  import org.w3c.dom.NodeList;
50  import org.w3c.dom.html2.HTMLCollection;  import org.w3c.dom.html2.HTMLCollection;
51    import org.w3c.dom.html2.HTMLOptionsCollection;
52  import org.w3c.dom.traversal.NodeFilter;  import org.w3c.dom.traversal.NodeFilter;
53  import org.w3c.dom.traversal.NodeIterator;  import org.w3c.dom.traversal.NodeIterator;
54    
# Line 55  import org.w3c.dom.traversal.NodeIterato Line 58  import org.w3c.dom.traversal.NodeIterato
58   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
59   */   */
60  class DomHTMLCollection  class DomHTMLCollection
61    implements HTMLCollection, NodeList, NodeFilter    implements HTMLCollection, HTMLOptionsCollection, NodeList, NodeFilter
62  {  {
63    
64    final DomHTMLDocument doc;    final DomHTMLDocument doc;
65      final Node root;
66    List nodeNames;    List nodeNames;
67    List attributeNames;    List attributeNames;
68    List results;    List results;
69    
70    DomHTMLCollection(DomHTMLDocument doc)    DomHTMLCollection(DomHTMLDocument doc, Node root)
71    {    {
72      this.doc = doc;        this.doc = doc;
73        this.root = root;
74    }    }
75    
76    // -- Node name and attribute filtering --    // -- Node name and attribute filtering --
# Line 159  class DomHTMLCollection Line 164  class DomHTMLCollection
164    
165    void evaluate()    void evaluate()
166    {    {
167      NodeIterator i = doc.createNodeIterator(doc, NodeFilter.SHOW_ELEMENT,      NodeIterator i = doc.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
168                                              this, true);                                              this, true);
169      results = new ArrayList();      results = new ArrayList();
170      for (Node node = i.nextNode(); node != null; node = i.nextNode())      for (Node node = i.nextNode(); node != null; node = i.nextNode())
# Line 175  class DomHTMLCollection Line 180  class DomHTMLCollection
180      return results.size();      return results.size();
181    }    }
182    
183      public void setLength(int length)
184      {
185        throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR);
186      }
187    
188    public Node item(int index)    public Node item(int index)
189    {    {
190      return (Node) results.get(index);      return (Node) results.get(index);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26