public abstract class AbstractFormattedWalker extends java.lang.Object implements Walker
The JDOM content can be loosely categorised in to 'Text-like' content (consisting of Text, CDATA, and EntityRef), and everything else. This distinction is significant for for this class and it's sub-classes.
There will be text manipulation, and some (but not necessarily all) Text-like content will be returned as text() instead of next().
The trick in this class is that it deals with the regular content, and delegates the Text-like content to the sub-classes.
Subclasses are tasked with analysing chunks of Text-like content in the
analyzeMultiText(MultiText, int, int)
method. The subclasses are
responsible for adding the relevant text content to the suppliedMultiText
instance in such a way as to result in the correct format.
The Subclass needs to concern itself with only the text portion because this abstract class will ensure the Text-like content is appropriately indented.
构造器和说明 |
---|
AbstractFormattedWalker(java.util.List<? extends Content> xx,
FormatStack fstack,
boolean doescape)
Create a Walker that preserves all content in its raw state.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
hasNext()
Behaves similarly to to a regular Iterator
|
boolean |
isAllText()
If all the content in this walker is empty, or if whatever content
is available is Text-like.
|
boolean |
isAllWhitespace()
If all the content is Text-like (
Walker.isAllText() returns true), and
additionally that any content is either Text or CDATA, and that the
values of these Text/CDATA members are all XML Whitespace. |
boolean |
isCDATA()
If the previous next() method returned null, then this will indicate
whether the current text() value is CDATA or regular Text.
|
Content |
next()
Similar to an Iterator, but null return values need special treatment.
|
java.lang.String |
text()
If the previous call to next() returned null, then this will return the
required text to be processed.
|
public AbstractFormattedWalker(java.util.List<? extends Content> xx, FormatStack fstack, boolean doescape)
xx
- the content to walk.fstack
- the current FormatStackdoescape
- Whether Text values should be escaped.public final Content next()
Walker
public final boolean isAllText()
Walker
public final boolean hasNext()
Walker
public final java.lang.String text()
Walker
public final boolean isCDATA()
Walker
public final boolean isAllWhitespace()
Walker
Walker.isAllText()
returns true), and
additionally that any content is either Text or CDATA, and that the
values of these Text/CDATA members are all XML Whitespace.isAllWhitespace
在接口中 Walker