|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
DOM Level 3 WD Experimental: The DOM Level 3 specification is at the stage of Working Draft, which represents work in progress and thus may be updated, replaced, or obsoleted by other documents at any time.
DOMBuilderFilter
s provide applications the ability to examine
nodes as they are being constructed during a parse. 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 DOMBuilderFilter
methods, i.e. it is not possible to filter out the document element. The
Document
, DocumentType
, Notation
,
and Entity
nodes are not passed to the filter.
All validity checking while reading 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 content, including default attributes, must be passed to the filter methods.
Any exception raised in the filter are ignored by the
DOMBuilder
. The description of these methods is not complete
See also the Document Object Model (DOM) Level 3 Load and Save Specification.
Field Summary | |
---|---|
static short |
FILTER_ACCEPT
Accept the node. |
static short |
FILTER_INTERRUPT
Interrupt the normal processing of the document. |
static short |
FILTER_REJECT
Reject the node abd its children. |
static short |
FILTER_SKIP
Skip this single node. |
Method Summary | |
---|---|
short |
acceptNode(org.w3c.dom.Node enode)
This method will be called by the parser at the completion of the parsing of each node. |
int |
getWhatToShow()
Tells the DOMBuilder what types of nodes to show to the
filter. |
short |
startElement(org.w3c.dom.Element elt)
This method will be called by the parser after each Element
start tag has been scanned, but before the remainder of the
Element is processed. |
Field Detail |
public static final short FILTER_ACCEPT
public static final short FILTER_REJECT
public static final short FILTER_SKIP
public static final short FILTER_INTERRUPT
Method Detail |
public short startElement(org.w3c.dom.Element elt)
Element
start tag has been scanned, but before the remainder of the
Element
is processed. The intent is to allow the
element, including any children, to be efficiently skipped. Note that
only element nodes are passed to the startElement
function.
startElement
for filtering
will include all of the Element's attributes, but none of the
children nodes. The Element may not yet be in place in the document
being constructed (it may not have a parent node.)
startElement
filter function may access or change
the attributes for the Element. Changing Namespace declarations will
have no effect on namespace resolution by the parser.
elt
- The newly encountered element. At the time this method is
called, the element is incomplete - it will have its attributes,
but no children.FILTER_ACCEPT
if this Element
should be included in the DOM document being built.
FILTER_REJECT
if the Element
and all of
its children should be rejected. FILTER_SKIP
if the
Element
should be rejected. All of its children are
inserted in place of the rejected Element
node.
FILTER_INTERRUPT
if the filter wants to stop the
processing of the document. Interrupting the processing of the
document does no longer guarantee that the entire is XML well-formed
. Returning any other values will result in unspecified behavior.public short acceptNode(org.w3c.dom.Node enode)
enode
- 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.FILTER_ACCEPT
if this Node
should
be included in the DOM document being built.
FILTER_REJECT
if the Node
and all of its
children should be rejected. FILTER_SKIP
if the
Node
should be skipped and the Node
should be replaced by all the children of the Node
.
FILTER_INTERRUPT
if the filter wants to stop the
processing of the document. Interrupting the processing of the
document does no longer guarantee that the entire is XML well-formed
.public int getWhatToShow()
DOMBuilder
what types of nodes to show to the
filter. See NodeFilter
for definition of the constants.
The constant SHOW_ATTRIBUTE
is meaningless here,
attribute nodes will never be passed to a
DOMBuilderFilter
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |