|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StAXFilter
In StAX Processing it is possible to read fragments of XML. JDOM supports reading JDOM Content from StAX Readers in fragments. JDOM users can influence the content that is processed by the return values in this interface.
Using the StAXStreamBuilder or StAXEventBuilder you can parse a List of JDOM content by filtering that content with an instance of this filter.
There are two significant states in which methods in this interface will be called:
Method Summary | |
---|---|
java.lang.String |
includeCDATA(int depth,
java.lang.String text)
The current event is a CDATA event. |
java.lang.String |
includeComment(int depth,
java.lang.String comment)
The current event is a Comment event. |
boolean |
includeDocType()
The current event is a DocType event. |
boolean |
includeElement(int depth,
java.lang.String name,
Namespace ns)
The current event is an Element event. |
boolean |
includeEntityRef(int depth,
java.lang.String name)
The current event is an EntityRef event. |
boolean |
includeProcessingInstruction(int depth,
java.lang.String target)
The current event is a ProcessingInstruction event. |
java.lang.String |
includeText(int depth,
java.lang.String text)
The current event is a TEXT event. |
java.lang.String |
pruneCDATA(int depth,
java.lang.String text)
An Element is being included, and this is a child CDATA event of the included parent Element. |
java.lang.String |
pruneComment(int depth,
java.lang.String comment)
An Element is being included, and this is a child Comment event of the included parent Element. |
boolean |
pruneElement(int depth,
java.lang.String name,
Namespace ns)
An Element is being included, and this is a child Element event of the included parent Element. |
boolean |
pruneEntityRef(int depth,
java.lang.String name)
An Element is being included, and this is a child EntityRef event of the included parent Element. |
boolean |
pruneProcessingInstruction(int depth,
java.lang.String target)
An Element is being included, and this is a child ProcessingInstruction event of the included parent Element. |
java.lang.String |
pruneText(int depth,
java.lang.String text)
An Element is being included, and this is a child Text event of the included parent Element. |
Method Detail |
---|
boolean includeDocType()
boolean includeElement(int depth, java.lang.String name, Namespace ns)
If the return value of this call is true, then this Element will be processed as a JDOM fragment. You may then get calls to the prune* methods to determine whether child content of this Element should be pruned.
depth
- The depth of this content from the document root
(the root Element is at depth 0)name
- The XML tag name of this Elementns
- The Namespace of this Element
java.lang.String includeComment(int depth, java.lang.String comment)
A null return value will cause the Comment to be ignored, and a non-null return value will become the Comment's text.
To include the comment as-is, do:
public String includeComment(int depth, String comment) { return comment; }
depth
- The depth of this content from the document root
(the root Element is at depth 0)comment
- The Comment value
boolean includeEntityRef(int depth, java.lang.String name)
depth
- The depth of this content from the document root
(the root Element is at depth 0)name
- The EntityRef name
java.lang.String includeCDATA(int depth, java.lang.String text)
A null return value will cause the Comment to be ignored, and a non-null return value will become the CDATA's text.
To include the CDATA as-is, do:
public String includeCDATA(int depth, String text) { return text; }
depth
- The depth of this content from the document root
(the root Element is at depth 0)text
- The CDATA text value
java.lang.String includeText(int depth, java.lang.String text)
A null return value will cause the Comment to be ignored, and a non-null return value will become the Text's text.
To include the Text as-is, do:
public String includeText(int depth, String text) { return text; }
depth
- The depth of this content from the document root
(the root Element is at depth 0)text
- The Text value
boolean includeProcessingInstruction(int depth, java.lang.String target)
depth
- The depth of this content from the document root
(the root Element is at depth 0)target
- The ProcessingInstruction Target value
boolean pruneElement(int depth, java.lang.String name, Namespace ns)
depth
- The depth of this content from the document root
(the root Element is at depth 0)name
- The XML tag name of this child Elementns
- The Namespace of this child Element
java.lang.String pruneComment(int depth, java.lang.String comment)
A non-null return value will become the Comment value. Return null to skip the Comment.
To include the Comment as-is, do:
public String pruneComment(int depth, String comment) { return comment; }
depth
- The depth of this content from the document root
(the root Element is at depth 0)comment
- The Comment value
boolean pruneEntityRef(int depth, java.lang.String name)
depth
- The depth of this content from the document root
(the root Element is at depth 0)name
- The EntityRef name
java.lang.String pruneCDATA(int depth, java.lang.String text)
A non-null return value will become the CDATA text. Return null to skip the CDATA.
To include the CDATA as-is, do:
public String pruneCDATA(int depth, String text) { return text; }
depth
- The depth of this content from the document root
(the root Element is at depth 0)text
- The CDATA text value
java.lang.String pruneText(int depth, java.lang.String text)
A non-null return value will become the Text. Return null to skip the Text.
To include the Text as-is, do:
public String pruneText(int depth, String text) { return text; }
depth
- The depth of this content from the document root
(the root Element is at depth 0)text
- The Text value
boolean pruneProcessingInstruction(int depth, java.lang.String target)
depth
- The depth of this content from the document root
(the root Element is at depth 0)target
- The ProcessingInstruction Target value
|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |