All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.jdom.filter.ContentFilter
ContentFilter is a general purpose Filter
representing all legal JDOM objects and allows the ability to set
and unset the visiblity of these objects. Filtering is accomplished by
way of a filtering mask in which each bit represents whether a JDOM
object is visible or not.
For example to view all Text and CDATA nodes in the content of element x.
Filter filter = new ContentFilter(ContentFilter.TEXT |
ContentFilter.CDATA);
List content = x.getContent(filter);
For those who don't like bit-masking, set methods are provided as an alternative. For example to allow everything except Comment nodes.
Filter filter = new ContentFilter();
filter.setCommentVisible(false);
List content = x.getContent(filter);
The default is to allow all valid JDOM objects.
CDATA objects
Comment objects
Document object
Element objects
EnitityRef objects
ProcessingInstruction objects
Text objects
Default constructor that allows any legal JDOM objects.
Set whether all JDOM objects are visible or not.
Filter out JDOM objects according to a filtering mask.
Check to see if the object can be added to the list.
Check to see if the object can be removed from the list.
Returns true if object is instance of ContentFilter and has the same filtering mask as this one.
Return current filtering mask.
Check to see if the object matches according to the filter mask.
Set visiblity of CDATA objects.
Set visiblity of Comment objects.
Set this filter to allow all legal JDOM objects.
Set filter to match only JDOM objects that are legal document content.
Set filter to match only JDOM objects that are legal element content.
Set visiblity of Element objects.
Set visiblity of EntityRef objects.
Set filtering mask.
Set visiblity of ProcessingInstruction objects.
Set visiblity of Text objects.
public static final int ELEMENT
Element objects
public static final int CDATA
CDATA objects
public static final int TEXT
Text objects
public static final int COMMENT
Comment objects
public static final int PI
ProcessingInstruction objects
public static final int ENTITYREF
EnitityRef objects
public static final int DOCUMENT
Document object
protected int filterMask
public ContentFilter()
Default constructor that allows any legal JDOM objects.
public ContentFilter(boolean allVisible)
Set whether all JDOM objects are visible or not.
true all JDOM objects are visible,
false all JDOM objects are hidden.
public ContentFilter(int mask)
Filter out JDOM objects according to a filtering mask.
public int getFilterMask()
Return current filtering mask.
public void setFilterMask(int mask)
Set filtering mask.
public void setDefaultMask()
Set this filter to allow all legal JDOM objects.
public void setDocumentContent()
Set filter to match only JDOM objects that are legal document content.
public void setElementContent()
Set filter to match only JDOM objects that are legal element content.
public void setElementVisible(boolean visible)
Set visiblity of Element objects.
true
if yes, false if not
public void setCDATAVisible(boolean visible)
Set visiblity of CDATA objects.
true
if yes, false if not
public void setTextVisible(boolean visible)
Set visiblity of Text objects.
true
if yes, false if not
public void setCommentVisible(boolean visible)
Set visiblity of Comment objects.
true
if yes, false if not
public void setPIVisible(boolean visible)
Set visiblity of ProcessingInstruction objects.
true if yes, false if not
public void setEntityRefVisible(boolean visible)
Set visiblity of EntityRef objects.
true
if yes, false if not
public boolean canAdd(Object obj)
Check to see if the object can be added to the list.
true if the object can be added.
public boolean canRemove(Object obj)
Check to see if the object can be removed from the list.
true if the object can be removed.
public boolean matches(Object obj)
Check to see if the object matches according to the filter mask.
true if the objected matched a predfined
set of rules.
public boolean equals(Object obj)
Returns true if object is instance of ContentFilter and has the same filtering mask as this one.
true if the Filters are equal
All Packages Class Hierarchy This Package Previous Next Index