|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.xml.pipeline.DomConsumer.Handler
gnu.xml.dom.Consumer.Backdoor
Implements the backdoors needed by DOM. All methods in this class use implementation-specific APIs that are implied by the DOM specification (needed to implement testable behavior) but which are excluded from the DOM specification.
Field Summary |
---|
Fields inherited from class gnu.xml.pipeline.DomConsumer.Handler |
---|
consumer |
Constructor Summary | |
---|---|
protected |
Consumer.Backdoor(DomConsumer consumer)
Constructor. |
Method Summary | |
---|---|
void |
attributeDecl(String ename,
String aname,
String type,
String mode,
String value)
Report an attribute type declaration. |
boolean |
canPopulateEntityRefs()
May be overridden by subclasses to return true, indicating that entity reference nodes can be populated and then made read-only. |
protected Text |
createText(boolean isCDATA,
char[] buf,
int off,
int len)
Subclasses may overrride this method to provide a more efficient way to construct text nodes. |
void |
endDocument()
Receive notification of the end of a document. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(String uri,
String localName,
String qName)
Receive notification of the end of an element. |
void |
endEntity(String name)
Report the end of an entity. |
void |
externalEntityDecl(String name,
String publicId,
String systemId)
Report a parsed external entity declaration. |
void |
internalEntityDecl(String name,
String value)
Report an internal entity declaration. |
void |
notationDecl(String name,
String publicId,
String systemId)
Receive notification of a notation declaration event. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startDTD(String name,
String publicId,
String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
Receive notification of the beginning of an element. |
void |
startEntity(String name)
Report the beginning of some internal and external XML entities. |
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Receive notification of an unparsed entity declaration event. |
Methods inherited from class gnu.xml.pipeline.DomConsumer.Handler |
---|
characters, comment, elementDecl, endCDATA, endPrefixMapping, getDocument, getTop, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startPrefixMapping |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Consumer.Backdoor(DomConsumer consumer) throws SAXException
consumer
- must have been initialized to use the
DomDocument
class (or a subclass) for
constructing DOM treesMethod Detail |
public void startDTD(String name, String publicId, String systemId) throws SAXException
LexicalHandler
This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
All declarations reported through
DTDHandler
or
DeclHandler
events must appear
between the startDTD and endDTD
events.
Declarations are assumed to belong to the internal DTD subset
unless they appear between startEntity
and endEntity
events. Comments and
processing instructions from the DTD should also be reported
between the startDTD and endDTD events, in their original
order of (logical) occurrence; they are not required to
appear in their correct locations relative to DTDHandler
or DeclHandler events, however.
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first
startElement
event.
startDTD
in interface LexicalHandler
startDTD
in class DomConsumer.Handler
SAXException
public void endDTD() throws SAXException
LexicalHandler
This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
endDTD
in interface LexicalHandler
endDTD
in class DomConsumer.Handler
SAXException
public void notationDecl(String name, String publicId, String systemId) throws SAXException
DTDHandler
It is up to the application to record the notation for later reference, if necessary; notations may appear as attribute values and in unparsed entity declarations, and are sometime used with processing instruction target names.
At least one of publicId and systemId must be non-null. If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application through this event.
There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.
notationDecl
in interface DTDHandler
notationDecl
in class DomConsumer.Handler
SAXException
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
DTDHandler
Note that the notation name corresponds to a notation
reported by the notationDecl
event.
It is up to the application to record the entity for later
reference, if necessary;
unparsed entities may appear as attribute values.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
unparsedEntityDecl
in interface DTDHandler
unparsedEntityDecl
in class DomConsumer.Handler
SAXException
public void internalEntityDecl(String name, String value) throws SAXException
DeclHandler
Only the effective (first) declaration for each entity will be reported. All parameter entities in the value will be expanded, but general entities will not.
internalEntityDecl
in interface DeclHandler
internalEntityDecl
in class DomConsumer.Handler
SAXException
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
DeclHandler
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface DeclHandler
externalEntityDecl
in class DomConsumer.Handler
SAXException
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
ContentHandler
The Parser will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
endElement
event for every startElement event
(even when the element is empty). All of the element's content will be
reported, in order, before the corresponding endElement
event.
This event allows up to three name components for each element:
Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:
Note that the attribute list provided will contain only
attributes with explicit values (specified or defaulted):
#IMPLIED attributes will be omitted. The attribute list
will contain attributes used for Namespace declarations
(xmlns* attributes) only if the
http://xml.org/sax/features/namespace-prefixes
property is true (it is false by default, and support for a
true value is optional).
startElement
in interface ContentHandler
startElement
in class DomConsumer.Handler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
ContentHandler
The SAX parser will invoke this method at the end of every
element in the XML document; there will be a corresponding
startElement
event for every endElement
event (even when the element is empty).
For information on the names, see startElement.
endElement
in interface ContentHandler
endElement
in class DomConsumer.Handler
SAXException
protected Text createText(boolean isCDATA, char[] buf, int off, int len)
DomConsumer.Handler
createText
in class DomConsumer.Handler
public void attributeDecl(String ename, String aname, String type, String mode, String value) throws SAXException
DeclHandler
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group with the separator "|" and all whitespace removed, or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed.
The value will be the value as reported to applications, appropriately normalized and with entity and character references expanded.
attributeDecl
in interface DeclHandler
attributeDecl
in class DomConsumer.Handler
SAXException
public void startDocument() throws SAXException
ContentHandler
The SAX parser will invoke this method only once, before any
other methods in this interface or in DTDHandler
(except for setDocumentLocator
).
startDocument
in interface ContentHandler
startDocument
in class DomConsumer.Handler
SAXException
public void endDocument() throws SAXException
ContentHandler
The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
endDocument
in interface ContentHandler
endDocument
in class DomConsumer.Handler
SAXException
public boolean canPopulateEntityRefs()
DomConsumer.Handler
canPopulateEntityRefs
in class DomConsumer.Handler
public void startEntity(String name) throws SAXException
LexicalHandler
The reporting of parameter entities (including
the external DTD subset) is optional, and SAX2 drivers that
report LexicalHandler events may not implement it; you can use the
http://xml.org/sax/features/lexical-handler/parameter-entities
feature to query or control the reporting of parameter entities.
General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".
When a SAX2 driver is providing these events, all other
events must be properly nested within start/end entity
events. There is no additional requirement that events from
DeclHandler
or
DTDHandler
be properly ordered.
Note that skipped entities will be reported through the
skippedEntity
event, which is part of the ContentHandler interface.
Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:
These will be silently expanded, with no indication of where the original entity boundaries were.
Note also that the boundaries of character references (which are not really entities anyway) are not reported.
All start/endEntity events must be properly nested.
startEntity
in interface LexicalHandler
startEntity
in class DomConsumer.Handler
SAXException
public void endEntity(String name) throws SAXException
LexicalHandler
endEntity
in interface LexicalHandler
endEntity
in class DomConsumer.Handler
SAXException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2007-02-12.