Package org.dom4j.io
Class SAXModifyContentHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.dom4j.io.SAXContentHandler
-
- org.dom4j.io.SAXModifyContentHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
,org.xml.sax.ext.DeclHandler
,org.xml.sax.ext.LexicalHandler
class SAXModifyContentHandler extends SAXContentHandler
This extension of the SAXContentHandler writes SAX events immediately to the provided XMLWriter, unless someorg.dom4.ElementHandler
is still handling the current Element.- See Also:
SAXContentHandler
-
-
Constructor Summary
Constructors Constructor Description SAXModifyContentHandler()
SAXModifyContentHandler(DocumentFactory documentFactory)
SAXModifyContentHandler(DocumentFactory documentFactory, ElementHandler elementHandler)
SAXModifyContentHandler(DocumentFactory documentFactory, ElementHandler elementHandler, ElementStack elementStack)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
activeHandlers()
void
characters(char[] parm1, int parm2, int parm3)
void
comment(char[] characters, int parm2, int parm3)
void
endCDATA()
void
endDocument()
void
endDTD()
void
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
void
endEntity(java.lang.String name)
void
endPrefixMapping(java.lang.String prefix)
protected XMLWriter
getXMLWriter()
void
ignorableWhitespace(char[] parm1, int parm2, int parm3)
void
notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Receive notification of a notation declaration event.void
processingInstruction(java.lang.String target, java.lang.String data)
void
setDocumentLocator(org.xml.sax.Locator locator)
void
setXMLWriter(XMLWriter writer)
void
skippedEntity(java.lang.String name)
void
startCDATA()
void
startDocument()
void
startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
void
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
void
startEntity(java.lang.String name)
void
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
void
unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation)
Receive notification of an unparsed entity declaration event.-
Methods inherited from class org.dom4j.io.SAXContentHandler
addAttributes, addDeclaredNamespaces, addDTDDeclaration, addExternalDTDDeclaration, attributeDecl, completeCurrentTextNode, createDocument, createElementStack, elementDecl, error, externalEntityDecl, fatalError, getDocument, getElementStack, getEntityResolver, getInputSource, internalEntityDecl, isIgnorableEntity, isIgnoreComments, isIncludeExternalDTDDeclarations, isIncludeInternalDTDDeclarations, isMergeAdjacentText, isStripWhitespaceText, setElementStack, setEntityResolver, setIgnoreComments, setIncludeExternalDTDDeclarations, setIncludeInternalDTDDeclarations, setInputSource, setMergeAdjacentText, setStripWhitespaceText, warning
-
-
-
-
Field Detail
-
xmlWriter
private XMLWriter xmlWriter
-
-
Constructor Detail
-
SAXModifyContentHandler
public SAXModifyContentHandler()
-
SAXModifyContentHandler
public SAXModifyContentHandler(DocumentFactory documentFactory)
-
SAXModifyContentHandler
public SAXModifyContentHandler(DocumentFactory documentFactory, ElementHandler elementHandler)
-
SAXModifyContentHandler
public SAXModifyContentHandler(DocumentFactory documentFactory, ElementHandler elementHandler, ElementStack elementStack)
-
-
Method Detail
-
setXMLWriter
public void setXMLWriter(XMLWriter writer)
-
startCDATA
public void startCDATA() throws org.xml.sax.SAXException
- Specified by:
startCDATA
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
startCDATA
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
startDTD
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
- Specified by:
startDTD
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
startDTD
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
endDTD
public void endDTD() throws org.xml.sax.SAXException
- Specified by:
endDTD
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
endDTD
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
comment
public void comment(char[] characters, int parm2, int parm3) throws org.xml.sax.SAXException
- Specified by:
comment
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
comment
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
startEntity
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
- Specified by:
startEntity
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
startEntity
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
endCDATA
public void endCDATA() throws org.xml.sax.SAXException
- Specified by:
endCDATA
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
endCDATA
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
endEntity
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
- Specified by:
endEntity
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
endEntity
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
unparsedEntityDecl
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notation) throws org.xml.sax.SAXException
Description copied from class:SAXContentHandler
Receive notification of an unparsed entity declaration event.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.If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
- Specified by:
unparsedEntityDecl
in interfaceorg.xml.sax.DTDHandler
- Overrides:
unparsedEntityDecl
in classSAXContentHandler
- Parameters:
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none was given.systemId
- The entity's system identifier.notation
- The name of the associated notation.- Throws:
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.- See Also:
SAXContentHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
,AttributeList
-
notationDecl
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
Description copied from class:SAXContentHandler
Receive notification of a notation declaration event.It is up to the application to record the notation for later reference, if necessary.
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.
- Specified by:
notationDecl
in interfaceorg.xml.sax.DTDHandler
- Overrides:
notationDecl
in classSAXContentHandler
- Parameters:
name
- The notation name.publicId
- The notation's public identifier, or null if none was given.systemId
- The notation's system identifier, or null if none was given.- Throws:
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.- See Also:
SAXContentHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,AttributeList
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] parm1, int parm2, int parm3) throws org.xml.sax.SAXException
- Specified by:
ignorableWhitespace
in interfaceorg.xml.sax.ContentHandler
- Overrides:
ignorableWhitespace
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
- Specified by:
processingInstruction
in interfaceorg.xml.sax.ContentHandler
- Overrides:
processingInstruction
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classSAXContentHandler
-
skippedEntity
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
- Specified by:
skippedEntity
in interfaceorg.xml.sax.ContentHandler
- Overrides:
skippedEntity
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
- Specified by:
startPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startPrefixMapping
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
- Specified by:
endPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endPrefixMapping
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] parm1, int parm2, int parm3) throws org.xml.sax.SAXException
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classSAXContentHandler
- Throws:
org.xml.sax.SAXException
-
getXMLWriter
protected XMLWriter getXMLWriter()
-
activeHandlers
private boolean activeHandlers()
-
-