Class DOMSAXContentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.dom4j.io.DOMSAXContentHandler
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler
SAXContentHandler builds W3C DOM object via SAX events.- Author:
- James Strachan , Todd Wolff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAttributes(Element element, Attributes attributes) protected voidaddDeclaredNamespaces(Element element) protected StringattributeNameForNamespace(Namespace namespace) voidcharacters(char[] ch, int start, int end) voidcomment(char[] ch, int start, int end) protected voidprotected Documentprotected org.dom4j.io.ElementStackvoidendCDATA()voidvoidendDTD()voidendElement(String namespaceURI, String localName, String qName) voidvoidendPrefixMapping(String prefix) voiderror(SAXParseException exception) This method is called when an error is detected during parsing such as a validation error.voidfatalError(SAXParseException exception) This method is called when a fatal error occurs during parsing.Retrieves w3c document object built via generated sax events.org.dom4j.io.ElementStackbooleanReturns whether we should ignore comments or not.booleanReturns whether adjacent text nodes should be merged together.booleanSets whether whitespace between element start and end tags should be ignoredvoidprocessingInstruction(String target, String data) voidsetDocumentLocator(Locator documentLocator) voidsetElementStack(org.dom4j.io.ElementStack elementStack) voidsetEntityResolver(EntityResolver entityResolver) voidsetIgnoreComments(boolean ignoreComments) Sets whether we should ignore comments or not.voidsetInputSource(InputSource inputSource) voidsetMergeAdjacentText(boolean mergeAdjacentText) Sets whether or not adjacent text nodes should be merged together when parsing.voidsetStripWhitespaceText(boolean stripWhitespaceText) Sets whether whitespace between element start and end tags should be ignored.voidvoidvoidvoidstartElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes) voidstartEntity(String name) voidstartPrefixMapping(String prefix, String uri) voidwarning(SAXParseException exception) This method is called when a warning occurs during the parsing of the document.Methods inherited from class DefaultHandler
ignorableWhitespace, notationDecl, resolveEntity, skippedEntity, unparsedEntityDeclMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Constructor Details
-
DOMSAXContentHandler
public DOMSAXContentHandler() -
DOMSAXContentHandler
-
-
Method Details
-
getDocument
Retrieves w3c document object built via generated sax events.- Returns:
- the document that has been or is being built
-
setDocumentLocator
- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classDefaultHandler
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classDefaultHandler- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classDefaultHandler- Throws:
SAXException
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
warning
This method is called when a warning occurs during the parsing of the document. This method does nothing.- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Parameters:
exception- DOCUMENT ME!- Throws:
SAXException- DOCUMENT ME!
-
error
This method is called when an error is detected during parsing such as a validation error. This method rethrows the exception- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Parameters:
exception- DOCUMENT ME!- Throws:
SAXException- DOCUMENT ME!
-
fatalError
This method is called when a fatal error occurs during parsing. This method rethrows the exception- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Parameters:
exception- DOCUMENT ME!- Throws:
SAXException- DOCUMENT ME!
-
startDTD
- Specified by:
startDTDin interfaceLexicalHandler- Throws:
SAXException
-
endDTD
- Specified by:
endDTDin interfaceLexicalHandler- Throws:
SAXException
-
startEntity
- Specified by:
startEntityin interfaceLexicalHandler- Throws:
SAXException
-
endEntity
- Specified by:
endEntityin interfaceLexicalHandler- Throws:
SAXException
-
startCDATA
- Specified by:
startCDATAin interfaceLexicalHandler- Throws:
SAXException
-
endCDATA
- Specified by:
endCDATAin interfaceLexicalHandler- Throws:
SAXException
-
comment
- Specified by:
commentin interfaceLexicalHandler- Throws:
SAXException
-
getElementStack
public org.dom4j.io.ElementStack getElementStack() -
setElementStack
public void setElementStack(org.dom4j.io.ElementStack elementStack) -
getEntityResolver
-
setEntityResolver
-
getInputSource
-
setInputSource
-
isMergeAdjacentText
public boolean isMergeAdjacentText()Returns whether adjacent text nodes should be merged together.- Returns:
- Value of property mergeAdjacentText.
-
setMergeAdjacentText
public void setMergeAdjacentText(boolean mergeAdjacentText) Sets whether or not adjacent text nodes should be merged together when parsing.- Parameters:
mergeAdjacentText- New value of property mergeAdjacentText.
-
isStripWhitespaceText
public boolean isStripWhitespaceText()Sets whether whitespace between element start and end tags should be ignored- Returns:
- Value of property stripWhitespaceText.
-
setStripWhitespaceText
public void setStripWhitespaceText(boolean stripWhitespaceText) Sets whether whitespace between element start and end tags should be ignored.- Parameters:
stripWhitespaceText- New value of property stripWhitespaceText.
-
isIgnoreComments
public boolean isIgnoreComments()Returns whether we should ignore comments or not.- Returns:
- boolean
-
setIgnoreComments
public void setIgnoreComments(boolean ignoreComments) Sets whether we should ignore comments or not.- Parameters:
ignoreComments- whether we should ignore comments or not.
-
completeCurrentTextNode
protected void completeCurrentTextNode() -
createDocument
-
addDeclaredNamespaces
-
addAttributes
-
createElementStack
protected org.dom4j.io.ElementStack createElementStack() -
attributeNameForNamespace
-