T - is the type of the outcome, returned by close(Document).public class DocumentRecurser<T> extends Object
| Constructor and Description |
|---|
DocumentRecurser() |
| Modifier and Type | Method and Description |
|---|---|
protected DocumentRecurser<T> |
attribute(Attr a)
Processes an attribute.
|
protected DocumentRecurser<T> |
attribute(String key,
String value)
Processes an attribute.
|
protected DocumentRecurser<T> |
attributes(Element e)
Processes the attributes of an element.
|
protected DocumentRecurser<T> |
cdata(CDATASection cd)
Processes a CData section.
|
protected DocumentRecurser<T> |
cdata(String s)
Processes a cdata section.
|
protected T |
close(Document d)
Finishes processing the document and returns the result.
|
protected DocumentRecurser<T> |
close(Element e)
Processes the closing tag of an element.
|
protected DocumentRecurser<T> |
comment(Comment c)
Processes a Comment.
|
protected DocumentRecurser<T> |
comment(String s)
Processes a comment.
|
protected DocumentRecurser<T> |
doctype(DocumentType type)
Processes the doctype.
|
T |
document(Document d)
Processes a document and returns the result.
|
protected DocumentRecurser<T> |
documentURI(String uri)
Processes the document URI.
|
protected DocumentRecurser<T> |
element(Element e)
Processes an element.
|
protected DocumentRecurser<T> |
entity(Entity e)
Processes an entity.
|
protected DocumentRecurser<T> |
entityReference(EntityReference er)
Processes an entity reference.
|
protected DocumentRecurser<T> |
fragment(DocumentFragment f)
Processes a document fragment.
|
protected DocumentRecurser<T> |
node(Node n)
Processes a node.
|
protected DocumentRecurser<T> |
nodes(NodeList ns)
Processes a list of nodes.
|
protected DocumentRecurser<T> |
notation(Notation n)
Processes a notation node.
|
protected DocumentRecurser<T> |
open(Document d)
Prepares processing a document.
|
protected DocumentRecurser<T> |
open(Element e)
Processes the opening tag of an element.
|
protected DocumentRecurser<T> |
processingInstruction(ProcessingInstruction i)
Processes a processing instruction.
|
protected DocumentRecurser<T> |
text(String s)
Processes a text.
|
protected DocumentRecurser<T> |
text(Text t)
Processes a Text.
|
public T document(Document d) throws Exception
open(d);
doctype(d.getDoctype());
documentURI(d.getDocumentURI());
Element e=d.getDocumentElement();
if(e!=null)
element(e);
return close(d);
d - the documentException - something wrongprotected DocumentRecurser<T> element(Element e) throws Exception
open(e);
nodes(e.getChildNodes());
close(e);
e - the elementException - something wrongprotected DocumentRecurser<T> attributes(Element e) throws Exception
attribute(a)for each.
e - the elementException - something wrongprotected DocumentRecurser<T> attribute(Attr a) throws Exception
attribute(a.getName(), a.getValue())
a - the attributeException - something wrongprotected DocumentRecurser<T> text(Text t) throws Exception
text(t.getData()).
t - the textException - something wrongprotected DocumentRecurser<T> comment(Comment c) throws Exception
comment(c.getData()).
c - the commentException - something wrongprotected DocumentRecurser<T> cdata(CDATASection cd) throws Exception
cdata(cd.getData()).
cd - the CDataException - something wrongprotected DocumentRecurser<T> nodes(NodeList ns) throws Exception
node(n)for each.
ns - the node listException - something wrongprotected DocumentRecurser<T> node(Node n) throws Exception
n - the nodeException - something wrongprotected DocumentRecurser<T> open(Document d) throws Exception
d - the documentException - something wrongprotected DocumentRecurser<T> doctype(DocumentType type) throws Exception
type - the typeException - something wrongprotected DocumentRecurser<T> documentURI(String uri) throws Exception
uri - the document URIException - something wrongprotected T close(Document d) throws Exception
d - the documentException - something wrongprotected DocumentRecurser<T> open(Element e) throws Exception
attributes(e).When you override, you must call attributes(e) yourself.
e - the elementException - something wrongprotected DocumentRecurser<T> close(Element e) throws Exception
e - the elementException - something wrongprotected DocumentRecurser<T> attribute(String key, String value) throws Exception
key - the keyvalue - the valueException - something wrongprotected DocumentRecurser<T> text(String s) throws Exception
s - the textException - something wrongprotected DocumentRecurser<T> cdata(String s) throws Exception
s - the CData textException - something wrongprotected DocumentRecurser<T> comment(String s) throws Exception
s - the comment textException - something wrongprotected DocumentRecurser<T> entity(Entity e) throws Exception
e - the entityException - something wrongprotected DocumentRecurser<T> entityReference(EntityReference er) throws Exception
er - the entity referenceException - something wrongprotected DocumentRecurser<T> notation(Notation n) throws Exception
n - the notationException - something wrongprotected DocumentRecurser<T> processingInstruction(ProcessingInstruction i) throws Exception
i - the processing instructionException - something wrongprotected DocumentRecurser<T> fragment(DocumentFragment f) throws Exception
f - the document fragmentException - something wrongCopyright © 2017. All rights reserved.