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.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| private static final String | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| private int | filterMask
The JDOM object mask |
| public static final int | PI
Mask for JDOM |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ContentFilter(boolean
true all JDOM objects are visible,
false all JDOM objects are hidden.Set whether all JDOM objects are visible or not. |
| public | ContentFilter(int
Mask of JDOM objects to allow. mask)Filter out JDOM objects according to a filtering mask. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: whether the two filters are equalthe object to compare against obj)Overrides java. |
| public int | |
| public int | |
| public boolean | Returns: true if the objected matched a predfined
set of rules.The object to verify. obj)Implements org. |
| public void | setCDATAVisible(boolean
whether CDATA nodes are visible, visible)true
if yes, false if notSet visiblity of |
| public void | setCommentVisible(boolean
whether Comments are visible, visible)true
if yes, false if notSet visiblity of |
| public void | |
| public void | setDocTypeVisible(boolean
whether the DocType is visible, visible)true
if yes, false if notSet visiblity of |
| public void | |
| public void | |
| public void | setElementVisible(boolean
whether Elements are visible, visible)true
if yes, false if notSet visiblity of |
| public void | setEntityRefVisible(boolean
whether EntityRefs are visible, visible)true
if yes, false if notSet visiblity of |
| public void | |
| public void | setPIVisible(boolean
whether ProcessingInstructions are visible,
visible)true if yes, false if notSet visiblity of |
| public void | setTextVisible(boolean
whether Text nodes are visible, visible)true
if yes, false if notSet visiblity of |
| CDATA | back to summary |
|---|---|
| public static final int CDATA Mask for JDOM | |
| COMMENT | back to summary |
|---|---|
| public static final int COMMENT Mask for JDOM | |
| CVS_ID | back to summary |
|---|---|
| private static final String CVS_ID | |
| DOCTYPE | back to summary |
|---|---|
| public static final int DOCTYPE Mask for JDOM | |
| DOCUMENT | back to summary |
|---|---|
| public static final int DOCUMENT Mask for JDOM | |
| ELEMENT | back to summary |
|---|---|
| public static final int ELEMENT Mask for JDOM | |
| ENTITYREF | back to summary |
|---|---|
| public static final int ENTITYREF Mask for JDOM | |
| filterMask | back to summary |
|---|---|
| private int filterMask The JDOM object mask | |
| PI | back to summary |
|---|---|
| public static final int PI Mask for JDOM | |
| TEXT | back to summary |
|---|---|
| public static final int TEXT Mask for JDOM | |
| ContentFilter | back to summary |
|---|---|
| public ContentFilter() Default constructor that allows any legal JDOM objects. | |
| ContentFilter | back to summary |
|---|---|
| public ContentFilter(boolean allVisible) Set whether all JDOM objects are visible or not.
| |
| ContentFilter | back to summary |
|---|---|
| public ContentFilter(int mask) Filter out JDOM objects according to a filtering mask.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Returns whether the two filters are equivalent (i.e. the matching mask values are identical).
| |
| getFilterMask | back to summary |
|---|---|
| public int getFilterMask() Return current filtering mask.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| matches | back to summary |
|---|---|
| public boolean matches(Object obj) Implements org. Check to see if the object matches according to the filter mask.
| |
| setCDATAVisible | back to summary |
|---|---|
| public void setCDATAVisible(boolean visible) Set visiblity of
| |
| setCommentVisible | back to summary |
|---|---|
| public void setCommentVisible(boolean visible) Set visiblity of
| |
| setDefaultMask | back to summary |
|---|---|
| public void setDefaultMask() Set this filter to allow all legal JDOM objects. | |
| setDocTypeVisible | back to summary |
|---|---|
| public void setDocTypeVisible(boolean visible) Set visiblity of
| |
| setDocumentContent | back to summary |
|---|---|
| public void setDocumentContent() Set filter to match only JDOM objects that are legal document content. | |
| setElementContent | back to summary |
|---|---|
| public void setElementContent() Set filter to match only JDOM objects that are legal element content. | |
| setElementVisible | back to summary |
|---|---|
| public void setElementVisible(boolean visible) Set visiblity of
| |
| setEntityRefVisible | back to summary |
|---|---|
| public void setEntityRefVisible(boolean visible) Set visiblity of
| |
| setFilterMask | back to summary |
|---|---|
| public void setFilterMask(int mask) Set filtering mask.
| |
| setPIVisible | back to summary |
|---|---|
| public void setPIVisible(boolean visible) Set visiblity of
| |
| setTextVisible | back to summary |
|---|---|
| public void setTextVisible(boolean visible) Set visiblity of
| |