LSParserFilter
s provide applications the ability to examine
nodes as they are being constructed while parsing. As each node is
examined, it may be modified or removed, or the entire parse may be
terminated early.
At the time any of the filter methods are called by the parser, the
owner Document and DOMImplementation objects exist and are accessible.
The document element is never passed to the LSParserFilter
methods, i.e. it is not possible to filter out the document element.
Document
, DocumentType
, Notation
,
Entity
, and Attr
nodes are never passed to the
acceptNode
method on the filter. The child nodes of an
EntityReference
node are passed to the filter if the parameter
"entities"
is set to false
. Note that, as described by the parameter
"entities",
unexpanded entity reference nodes are never discarded and are always
passed to the filter.
All validity checking while parsing a document occurs on the source document as it appears on the input stream, not on the DOM document as it is built in memory. With filters, the document in memory may be a subset of the document on the stream, and its validity may have been affected by the filtering.
All default attributes must be present on elements when the elements are passed to the filter methods. All other default content must be passed to the filter methods.
DOM applications must not raise exceptions in a filter. The effect of throwing exceptions from a filter is DOM implementation dependent.
See also the Document Object Model (DOM) Level 3 Load and Save Specification.
Modifier and Type | Field and Description |
---|---|
public static final short | FILTER_ACCEPT
Accept the node. |
public static final short | FILTER_INTERRUPT
Interrupt the normal processing of the document. |
public static final short | FILTER_REJECT
Reject the node and its children. |
public static final short | FILTER_SKIP
Skip this single node. |
Modifier and Type | Method and Description |
---|---|
public short | Returns:
The newly constructed element. At the time this method
is called, the element is complete - it has all of its children
(and their children, recursively) and attributes, and is attached
as a child to its parent. nodeArg)This method will be called by the parser at the completion of the parsing of each node. |
public int | getWhatToShow()
Tells the |
public short | Returns:
The newly encountered element. At the time this
method is called, the element is incomplete - it will have its
attributes, but no children. elementArg)The parser will call this method after each |
FILTER_ACCEPT | back to summary |
---|---|
public static final short FILTER_ACCEPT Accept the node. |
FILTER_INTERRUPT | back to summary |
---|---|
public static final short FILTER_INTERRUPT Interrupt the normal processing of the document. |
FILTER_REJECT | back to summary |
---|---|
public static final short FILTER_REJECT Reject the node and its children. |
FILTER_SKIP | back to summary |
---|---|
public static final short FILTER_SKIP Skip this single node. The children of this node will still be considered. |
acceptNode | back to summary |
---|---|
public short acceptNode(Node nodeArg) This method will be called by the parser at the completion of the
parsing of each node. The node and all of its descendants will exist
and be complete. The parent node will also exist, although it may be
incomplete, i.e. it may have additional children that have not yet
been parsed. Attribute nodes are never passed to this function.
|
getWhatToShow | back to summary |
---|---|
public int getWhatToShow() Tells the |
startElement | back to summary |
---|---|
public short startElement(Element elementArg) The parser will call this method after each
|