gnu.xml.pipeline

Class DomConsumer.Handler

public static class DomConsumer.Handler extends Object implements ContentHandler, LexicalHandler, DTDHandler, DeclHandler

Class used to intercept various parsing events and use them to populate a DOM document. Subclasses would typically know and use backdoors into specific DOM implementations, used to implement DTD-related functionality.

Note that if this ever throws a DOMException (runtime exception) that will indicate a bug in the DOM (e.g. doesn't support something per specification) or the parser (e.g. emitted an illegal name, or accepted illegal input data).

Field Summary
protected DomConsumerconsumer
Constructor Summary
protected Handler(DomConsumer consumer)
Subclasses may use SAX2 events to provide additional behaviors in the resulting DOM.
Method Summary
voidattributeDecl(String eName, String aName, String type, String mode, String value)
booleancanPopulateEntityRefs()
May be overridden by subclasses to return true, indicating that entity reference nodes can be populated and then made read-only.
voidcharacters(char[] ch, int start, int length)
voidcomment(char[] ch, int start, int length)
protected TextcreateText(boolean isCDATA, char[] ch, int start, int length)
Subclasses may overrride this method to provide a more efficient way to construct text nodes.
voidelementDecl(String name, String model)
voidendCDATA()
voidendDocument()
voidendDTD()
voidendElement(String uri, String localName, String qName)
voidendEntity(String name)
voidendPrefixMapping(String prefix)
voidexternalEntityDecl(String name, String publicId, String SystemId)
protected DocumentgetDocument()
Returns the document under construction.
protected NodegetTop()
Returns the current node being populated.
voidignorableWhitespace(char[] ch, int start, int length)
voidinternalEntityDecl(String name, String value)
voidnotationDecl(String name, String publicId, String SystemId)
voidprocessingInstruction(String target, String data)
voidsetDocumentLocator(Locator locator)
voidskippedEntity(String name)
voidstartCDATA()
voidstartDocument()
voidstartDTD(String name, String publicId, String SystemId)
voidstartElement(String uri, String localName, String qName, Attributes atts)
voidstartEntity(String name)
voidstartPrefixMapping(String prefix, String uri)
voidunparsedEntityDecl(String name, String publicId, String SystemId, String notationName)

Field Detail

consumer

protected DomConsumer consumer

Constructor Detail

Handler

protected Handler(DomConsumer consumer)
Subclasses may use SAX2 events to provide additional behaviors in the resulting DOM.

Method Detail

attributeDecl

public void attributeDecl(String eName, String aName, String type, String mode, String value)

canPopulateEntityRefs

public boolean canPopulateEntityRefs()
May be overridden by subclasses to return true, indicating that entity reference nodes can be populated and then made read-only.

characters

public void characters(char[] ch, int start, int length)

comment

public void comment(char[] ch, int start, int length)

createText

protected Text createText(boolean isCDATA, char[] ch, int start, int length)
Subclasses may overrride this method to provide a more efficient way to construct text nodes. Typically, copying the text into a single character array will be more efficient than doing that as well as allocating other needed for a String, including an internal StringBuffer. Those additional memory and CPU costs can be incurred later, if ever needed. Unfortunately the standard DOM factory APIs encourage those costs to be incurred early.

elementDecl

public void elementDecl(String name, String model)

endCDATA

public void endCDATA()

endDocument

public void endDocument()

endDTD

public void endDTD()

endElement

public void endElement(String uri, String localName, String qName)

endEntity

public void endEntity(String name)

endPrefixMapping

public void endPrefixMapping(String prefix)

externalEntityDecl

public void externalEntityDecl(String name, String publicId, String SystemId)

getDocument

protected Document getDocument()
Returns the document under construction.

getTop

protected Node getTop()
Returns the current node being populated. This is usually an Element or Document, but it might be an EntityReference node if some implementation-specific code knows how to put those into the result tree and later mark them as readonly.

ignorableWhitespace

public void ignorableWhitespace(char[] ch, int start, int length)

internalEntityDecl

public void internalEntityDecl(String name, String value)

notationDecl

public void notationDecl(String name, String publicId, String SystemId)

processingInstruction

public void processingInstruction(String target, String data)

setDocumentLocator

public void setDocumentLocator(Locator locator)

skippedEntity

public void skippedEntity(String name)

startCDATA

public void startCDATA()

startDocument

public void startDocument()

startDTD

public void startDTD(String name, String publicId, String SystemId)

startElement

public void startElement(String uri, String localName, String qName, Attributes atts)

startEntity

public void startEntity(String name)

startPrefixMapping

public void startPrefixMapping(String prefix, String uri)

unparsedEntityDecl

public void unparsedEntityDecl(String name, String publicId, String SystemId, String notationName)

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 2013-01-12.