Package org.jdom2.output.support
Class WalkerPRESERVE
java.lang.Object
org.jdom2.output.support.WalkerPRESERVE
- All Implemented Interfaces:
Walker
This Walker implementation walks a list of Content in its original RAW
format. There is no text manipulation, and all content will be returned as
the input type. In other words, next() will never be null, and text() will
always be null.
- Author:
- Rolf Lear
-
Constructor Summary
ConstructorsConstructorDescriptionWalkerPRESERVE
(List<? extends Content> content) Create a Walker that preserves all content in its raw state. -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Behaves similarly to to a regular Iteratorboolean
If all the content in this walker is empty, or if whatever content is available is Text-like.boolean
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.next()
Similar to an Iterator, but null return values need special treatment.text()
If the previous call to next() returned null, then this will return the required text to be processed.
-
Constructor Details
-
WalkerPRESERVE
Create a Walker that preserves all content in its raw state.- Parameters:
content
- the content to walk.
-
-
Method Details
-
isAllText
public boolean isAllText()Description copied from interface:Walker
-
hasNext
public boolean hasNext()Description copied from interface:Walker
Behaves similarly to to a regular Iterator -
next
Description copied from interface:Walker
Similar to an Iterator, but null return values need special treatment. -
text
Description copied from interface:Walker
If the previous call to next() returned null, then this will return the required text to be processed. Check to see whether this text is CDATA by calling the isCDATA() method. -
isCDATA
public boolean isCDATA()Description copied from interface:Walker
If the previous next() method returned null, then this will indicate whether the current text() value is CDATA or regular Text. -
isAllWhitespace
public boolean isAllWhitespace()Description copied from interface:Walker
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.- Specified by:
isAllWhitespace
in interfaceWalker
- Returns:
- true
-