|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimple.util.xml.Traverser
public abstract class Traverser
The Traverser
object is used to parse an XML document
in a simple element by element manner. This makes use of KDOM to
parse and represent the document as a tree. Once the tree has been
created each element is processed from the KDOM in order, that is,
first come first served. This provides a SAX like parsing model
using KDOM, this allows simple parsing with optional KDOM usage.
Constructor Summary | |
---|---|
protected |
Traverser()
Constructor for the Traverser object this is used
to create a new instance with a new document builder object. |
Method Summary | |
---|---|
protected void |
commit(Node node)
Once an element and all its child elements have been processed this method is invoked to close the processing of the element. |
protected void |
finish()
When all elements of the KDOM have been traversed this method is used to perform post processing of the collected data. |
void |
parse(org.kxml2.kdom.Element source)
This is used to parse the provided KDOM element. |
void |
parse(java.io.File source)
This is used to parse the provided source document. |
void |
parse(java.io.File source,
java.lang.String charset)
This is used to parse the provided source document. |
void |
parse(java.io.InputStream source)
This is used to parse the provided source document. |
void |
parse(java.io.InputStream source,
java.lang.String charset)
This is used to parse the provided source document. |
void |
parse(Node source)
This method is provided as a convinience for parsing the node provided. |
void |
parse(java.io.Reader source)
This is used to parse the provided source document. |
void |
parse(java.lang.String source)
This is used to parse the provided source document. |
protected abstract void |
process(Node node)
This is used to process an element from the KDOM document. |
protected abstract void |
start()
This is used to initialize the XML parser. |
protected void |
traverse(org.kxml2.kdom.Element node)
This method is used to traverse all KDOM nodes acquired. |
protected void |
traverse(org.kxml2.kdom.Element node,
int count)
This method is used to traverse all KDOM nodes acquired. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Traverser()
Traverser
object this is used
to create a new instance with a new document builder object.
This will simply query a document builder factory for a default
implementation, which it will use to parse all KDOM documents.
Method Detail |
---|
public void parse(java.lang.String source) throws java.lang.Exception
source
- this is the XML document source to be parsed
java.lang.Exception
public void parse(java.io.File source) throws java.lang.Exception
source
- this is the XML document source file to parse
java.lang.Exception
public void parse(java.io.File source, java.lang.String charset) throws java.lang.Exception
source
- this is the XML document source file to parsecharset
- this is the character set to read the XML with
java.lang.Exception
public void parse(java.io.InputStream source) throws java.lang.Exception
source
- this is the XML document source to be parsed
java.lang.Exception
public void parse(java.io.InputStream source, java.lang.String charset) throws java.lang.Exception
source
- this is the XML document source to be parsedcharset
- this is the charset to read the stream with
java.lang.Exception
public void parse(java.io.Reader source) throws java.lang.Exception
source
- this is the XML document source to be parsed
java.lang.Exception
public void parse(org.kxml2.kdom.Element source) throws java.lang.Exception
start
method is invoked before the KDOM
object is traversed. Once the traversal has finished the parser
can commit all data using the finish
method.
source
- this is the XML document that is to be parsed
java.lang.Exception
public void parse(Node source) throws java.lang.Exception
parse(Element)
with the element taken from the given node. This will be used
if an XML parser wishes to delegate to another, which can be
done by simply invoking this method with a visited node
source
- this is the XML element thay is to be parsed
java.lang.Exception
protected void traverse(org.kxml2.kdom.Element node) throws java.lang.Exception
node
- this is the KDOM element to be traversed
java.lang.Exception
protected void traverse(org.kxml2.kdom.Element node, int count) throws java.lang.Exception
node
- this is the KDOM node list to be traversedcount
- this is the number of elements to traverse
java.lang.Exception
protected void commit(Node node) throws java.lang.Exception
node
- this is the node that has just finished traversal
java.lang.Exception
protected void finish() throws java.lang.Exception
java.lang.Exception
protected abstract void start() throws java.lang.Exception
java.lang.Exception
protected abstract void process(Node node) throws java.lang.Exception
node
- this is the node that is to be processed by this
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |