4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
NodeIterator.java
Go to the documentation of this file.
1 /*
2  * Project: Server for annotations sharing
3  * Subproject: Position of fragment of text in XML document
4  * Author: Michael Angelov
5  * Edited by: Ing. Jaroslav Dytrych idytrych@fit.vutbr.cz
6  * File: NodeIterator.java
7  * Description: Generic class for node iterators
8  */
9 
10 /**
11  * @file NodeIterator.java
12  *
13  * @brief Generic class for node iterators
14  */
15 
16 /**
17  * @package cz.vutbr.fit.knot.annotations.fragmentUpdater.nodeIterators
18  *
19  * @brief Node iterators for iterating through XML document nodes
20  */
21 package cz.vutbr.fit.knot.annotations.fragmentUpdater.nodeIterators;
22 
23 import javax.xml.xpath.XPathExpression;
24 import javax.xml.xpath.XPathExpressionException;
25 import org.w3c.dom.Document;
26 import org.w3c.dom.Node;
27 import org.w3c.dom.NodeList;
28 
29 /**
30  * Generic class for node iterators
31  *
32  * @brief Generic class for node iterators
33  * @author Michael Angelov
34  */
35 public abstract class NodeIterator {
36 
37  protected Document document;
38  public NodeList nodeList;
39  public int currentNodeIndex;
40 
41  /**
42  * Abstract method for node iterator initialization
43  *
44  * @param document document whose nodes will be iterated through
45  * @param expr XPath expression according to which iterating will be provided
46  */
47  abstract public void init(Document document, XPathExpression expr) throws XPathExpressionException;
48 
49  /**
50  * Method for getting iterator's next node
51  *
52  * @return iterator's next node
53  */
54  abstract public Node nextNode();
55 
56 }
abstract void init(Document document, XPathExpression expr)