Top Description Constructors Methods
org.jdom2.input.stax

public Class DefaultStAXFilter

extends Object
implements StAXFilter
Class Inheritance
All Implemented Interfaces
org.jdom2.input.stax.StAXFilter
Imports
org.jdom2.Namespace

This DefaultStAXFilter includes all content and prunes nothing.

Override this class to make adjustments to get the results you need.

Author
Rolf Lear
See Also
StAXFilter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
includeCDATA(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The CDATA text value
text
)

Implements org.jdom2.input.stax.StAXFilter.includeCDATA.

The current event is a CDATA event.
public String
includeComment(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The Comment value
comment
)

Implements org.jdom2.input.stax.StAXFilter.includeComment.

The current event is a Comment event.
public boolean
includeDocType()

Implements org.jdom2.input.stax.StAXFilter.includeDocType.

The current event is a DocType event.
public boolean
includeElement(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The XML tag name of this Element
name
,
final Namespace
The Namespace of this Element
ns
)

Implements org.jdom2.input.stax.StAXFilter.includeElement.

The current event is an Element event.
public boolean
includeEntityRef(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The EntityRef name
name
)

Implements org.jdom2.input.stax.StAXFilter.includeEntityRef.

The current event is an EntityRef event.
public boolean
includeProcessingInstruction(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The ProcessingInstruction Target value
target
)

Implements org.jdom2.input.stax.StAXFilter.includeProcessingInstruction.

The current event is a ProcessingInstruction event.
public String
includeText(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The Text value
text
)

Implements org.jdom2.input.stax.StAXFilter.includeText.

The current event is a TEXT event.
public String
pruneCDATA(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The CDATA text value
text
)

Implements org.jdom2.input.stax.StAXFilter.pruneCDATA.

An Element is being included, and this is a child CDATA event of the included parent Element.
public String
pruneComment(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The Comment value
comment
)

Implements org.jdom2.input.stax.StAXFilter.pruneComment.

An Element is being included, and this is a child Comment event of the included parent Element.
public boolean
pruneElement(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The XML tag name of this child Element
name
,
final Namespace
The Namespace of this child Element
ns
)

Implements org.jdom2.input.stax.StAXFilter.pruneElement.

An Element is being included, and this is a child Element event of the included parent Element.
public boolean
pruneEntityRef(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The EntityRef name
name
)

Implements org.jdom2.input.stax.StAXFilter.pruneEntityRef.

An Element is being included, and this is a child EntityRef event of the included parent Element.
public boolean
pruneProcessingInstruction(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The ProcessingInstruction Target value
target
)

Implements org.jdom2.input.stax.StAXFilter.pruneProcessingInstruction.

An Element is being included, and this is a child ProcessingInstruction event of the included parent Element.
public String
pruneText(final int
The depth of this content from the document root (the root Element is at depth 0)
depth
,
final String
The Text value
text
)

Implements org.jdom2.input.stax.StAXFilter.pruneText.

An Element is being included, and this is a child Text event of the included parent Element.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultStAXFilterback to summary
public DefaultStAXFilter()

Method Detail

includeCDATAback to summary
public String includeCDATA(final int depth, final String text)

Implements org.jdom2.input.stax.StAXFilter.includeCDATA.

Doc from org.jdom2.input.stax.StAXFilter.includeCDATA.

The current event is a CDATA event.

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;
}
Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

text:String

The CDATA text value

Returns:String

null if you want to exclude this CDATA, or a non-null value which will become the new CDATA text value.

Annotations
@Override
includeCommentback to summary
public String includeComment(final int depth, final String comment)

Implements org.jdom2.input.stax.StAXFilter.includeComment.

Doc from org.jdom2.input.stax.StAXFilter.includeComment.

The current event is a Comment event.

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;
}
Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

comment:String

The Comment value

Returns:String

null if you want to exclude this comment, or a non-null value which will become the new comment value.

Annotations
@Override
includeDocTypeback to summary
public boolean includeDocType()

Implements org.jdom2.input.stax.StAXFilter.includeDocType.

Doc from org.jdom2.input.stax.StAXFilter.includeDocType.

The current event is a DocType event.

Returns:boolean

true if the DocType should become a JDOM Fragment.

Annotations
@Override
includeElementback to summary
public boolean includeElement(final int depth, final String name, final Namespace ns)

Implements org.jdom2.input.stax.StAXFilter.includeElement.

Doc from org.jdom2.input.stax.StAXFilter.includeElement.

The current event is an Element event.

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.

Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

name:String

The XML tag name of this Element

ns:Namespace

The Namespace of this Element

Returns:boolean

true if the Element should become a JDOM Fragment.

Annotations
@Override
includeEntityRefback to summary
public boolean includeEntityRef(final int depth, final String name)

Implements org.jdom2.input.stax.StAXFilter.includeEntityRef.

Doc from org.jdom2.input.stax.StAXFilter.includeEntityRef.

The current event is an EntityRef event.

Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

name:String

The EntityRef name

Returns:boolean

true if you want to include this EntityRef.

Annotations
@Override
includeProcessingInstructionback to summary
public boolean includeProcessingInstruction(final int depth, final String target)

Implements org.jdom2.input.stax.StAXFilter.includeProcessingInstruction.

Doc from org.jdom2.input.stax.StAXFilter.includeProcessingInstruction.

The current event is a ProcessingInstruction event.

Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

target:String

The ProcessingInstruction Target value

Returns:boolean

true if you want to include this ProcessingInstruction.

Annotations
@Override
includeTextback to summary
public String includeText(final int depth, final String text)

Implements org.jdom2.input.stax.StAXFilter.includeText.

Doc from org.jdom2.input.stax.StAXFilter.includeText.

The current event is a TEXT event.

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;
}
Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

text:String

The Text value

Returns:String

null if you want to exclude this Text, or a non-null value which will become the new Text value.

Annotations
@Override
pruneCDATAback to summary
public String pruneCDATA(final int depth, final String text)

Implements org.jdom2.input.stax.StAXFilter.pruneCDATA.

Doc from org.jdom2.input.stax.StAXFilter.pruneCDATA.

An Element is being included, and this is a child CDATA event of the included parent Element. Should this child CDATA be pruned from the parent fragment?

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;
}
Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

text:String

The CDATA text value

Returns:String

null if you want to exclude this CDATA, or a non-null value which will become the new CDATA text value.

Annotations
@Override
pruneCommentback to summary
public String pruneComment(final int depth, final String comment)

Implements org.jdom2.input.stax.StAXFilter.pruneComment.

Doc from org.jdom2.input.stax.StAXFilter.pruneComment.

An Element is being included, and this is a child Comment event of the included parent Element. Should this child Comment be pruned from the parent fragment?

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;
}
Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

comment:String

The Comment value

Returns:String

null if you want to exclude this Comment, or a non-null value which will become the new Comment value.

Annotations
@Override
pruneElementback to summary
public boolean pruneElement(final int depth, final String name, final Namespace ns)

Implements org.jdom2.input.stax.StAXFilter.pruneElement.

Doc from org.jdom2.input.stax.StAXFilter.pruneElement.

An Element is being included, and this is a child Element event of the included parent Element. Should this Child Element be pruned from the parent fragment?

Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

name:String

The XML tag name of this child Element

ns:Namespace

The Namespace of this child Element

Returns:boolean

true if the child Element should be excluded.

Annotations
@Override
pruneEntityRefback to summary
public boolean pruneEntityRef(final int depth, final String name)

Implements org.jdom2.input.stax.StAXFilter.pruneEntityRef.

Doc from org.jdom2.input.stax.StAXFilter.pruneEntityRef.

An Element is being included, and this is a child EntityRef event of the included parent Element. Should this child EntityRef be pruned from the parent fragment?

Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

name:String

The EntityRef name

Returns:boolean

true if you want to exclude this EntityRef.

Annotations
@Override
pruneProcessingInstructionback to summary
public boolean pruneProcessingInstruction(final int depth, final String target)

Implements org.jdom2.input.stax.StAXFilter.pruneProcessingInstruction.

Doc from org.jdom2.input.stax.StAXFilter.pruneProcessingInstruction.

An Element is being included, and this is a child ProcessingInstruction event of the included parent Element. Should this ProcessingInstruction be pruned from the parent fragment?

Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

target:String

The ProcessingInstruction Target value

Returns:boolean

true if you want to exclude this ProcessingInstruction.

Annotations
@Override
pruneTextback to summary
public String pruneText(final int depth, final String text)

Implements org.jdom2.input.stax.StAXFilter.pruneText.

Doc from org.jdom2.input.stax.StAXFilter.pruneText.

An Element is being included, and this is a child Text event of the included parent Element. Should this child Text be pruned from the parent fragment?

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;
}
Parameters
depth:int

The depth of this content from the document root (the root Element is at depth 0)

text:String

The Text value

Returns:String

null if you want to exclude this Text, or a non-null value which will become the new Text value.

Annotations
@Override