Package org.dom4j.io
Class DOMSAXContentHandler
- java.lang.Object
- 
- org.xml.sax.helpers.DefaultHandler
- 
- org.dom4j.io.DOMSAXContentHandler
 
 
- 
- All Implemented Interfaces:
- org.xml.sax.ContentHandler,- org.xml.sax.DTDHandler,- org.xml.sax.EntityResolver,- org.xml.sax.ErrorHandler,- org.xml.sax.ext.LexicalHandler
 
 public class DOMSAXContentHandler extends org.xml.sax.helpers.DefaultHandler implements org.xml.sax.ext.LexicalHandlerSAXContentHandlerbuilds W3C DOM object via SAX events.
- 
- 
Constructor SummaryConstructors Constructor Description DOMSAXContentHandler()DOMSAXContentHandler(DOMDocumentFactory documentFactory)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAttributes(Element element, org.xml.sax.Attributes attributes)protected voidaddDeclaredNamespaces(Element element)protected java.lang.StringattributeNameForNamespace(Namespace namespace)voidcomment(char[] ch, int start, int end)protected voidcompleteCurrentTextNode()protected DocumentcreateDocument()protected org.dom4j.io.ElementStackcreateElementStack()voidendCDATA()voidendDocument()voidendDTD()voidendElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)voidendEntity(java.lang.String name)voidendPrefixMapping(java.lang.String prefix)voiderror(org.xml.sax.SAXParseException exception)This method is called when an error is detected during parsing such as a validation error.voidfatalError(org.xml.sax.SAXParseException exception)This method is called when a fatal error occurs during parsing.org.w3c.dom.DocumentgetDocument()Retrieves w3c document object built via generated sax events.org.dom4j.io.ElementStackgetElementStack()org.xml.sax.EntityResolvergetEntityResolver()org.xml.sax.InputSourcegetInputSource()voidcharacters(char[] ch, int start, int end)booleanisIgnoreComments()Returns whether we should ignore comments or not.booleanisMergeAdjacentText()Returns whether adjacent text nodes should be merged together.booleanisStripWhitespaceText()Sets whether whitespace between element start and end tags should be ignoredvoidprocessingInstruction(java.lang.String target, java.lang.String data)voidsetDocumentLocator(org.xml.sax.Locator documentLocator)voidsetElementStack(org.dom4j.io.ElementStack elementStack)voidsetEntityResolver(org.xml.sax.EntityResolver entityResolver)voidsetIgnoreComments(boolean ignoreComments)Sets whether we should ignore comments or not.voidsetInputSource(org.xml.sax.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.voidstartCDATA()voidstartDocument()voidstartDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)voidstartElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)voidstartEntity(java.lang.String name)voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)voidwarning(org.xml.sax.SAXParseException exception)This method is called when a warning occurs during the parsing of the document.
 
- 
- 
- 
Constructor Detail- 
DOMSAXContentHandlerpublic DOMSAXContentHandler() 
 - 
DOMSAXContentHandlerpublic DOMSAXContentHandler(DOMDocumentFactory documentFactory) 
 
- 
 - 
Method Detail- 
getDocumentpublic org.w3c.dom.Document getDocument() Retrieves w3c document object built via generated sax events.- Returns:
- the document that has been or is being built
 
 - 
setDocumentLocatorpublic void setDocumentLocator(org.xml.sax.Locator documentLocator) - Specified by:
- setDocumentLocatorin interface- org.xml.sax.ContentHandler
- Overrides:
- setDocumentLocatorin class- org.xml.sax.helpers.DefaultHandler
 
 - 
processingInstructionpublic void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException- Specified by:
- processingInstructionin interface- org.xml.sax.ContentHandler
- Overrides:
- processingInstructionin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
startPrefixMappingpublic void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException- Specified by:
- startPrefixMappingin interface- org.xml.sax.ContentHandler
- Overrides:
- startPrefixMappingin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
endPrefixMappingpublic void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException- Specified by:
- endPrefixMappingin interface- org.xml.sax.ContentHandler
- Overrides:
- endPrefixMappingin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
startDocumentpublic void startDocument() throws org.xml.sax.SAXException- Specified by:
- startDocumentin interface- org.xml.sax.ContentHandler
- Overrides:
- startDocumentin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
endDocumentpublic void endDocument() throws org.xml.sax.SAXException- Specified by:
- endDocumentin interface- org.xml.sax.ContentHandler
- Overrides:
- endDocumentin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
startElementpublic void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException- Specified by:
- startElementin interface- org.xml.sax.ContentHandler
- Overrides:
- startElementin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
endElementpublic void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException- Specified by:
- endElementin interface- org.xml.sax.ContentHandler
- Overrides:
- endElementin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
characterspublic void characters(char[] ch, int start, int end) throws org.xml.sax.SAXException- Specified by:
- charactersin interface- org.xml.sax.ContentHandler
- Overrides:
- charactersin class- org.xml.sax.helpers.DefaultHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
warningpublic void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionThis method is called when a warning occurs during the parsing of the document. This method does nothing.- Specified by:
- warningin interface- org.xml.sax.ErrorHandler
- Overrides:
- warningin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- exception- DOCUMENT ME!
- Throws:
- org.xml.sax.SAXException- DOCUMENT ME!
 
 - 
errorpublic void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionThis method is called when an error is detected during parsing such as a validation error. This method rethrows the exception- Specified by:
- errorin interface- org.xml.sax.ErrorHandler
- Overrides:
- errorin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- exception- DOCUMENT ME!
- Throws:
- org.xml.sax.SAXException- DOCUMENT ME!
 
 - 
fatalErrorpublic void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXExceptionThis method is called when a fatal error occurs during parsing. This method rethrows the exception- Specified by:
- fatalErrorin interface- org.xml.sax.ErrorHandler
- Overrides:
- fatalErrorin class- org.xml.sax.helpers.DefaultHandler
- Parameters:
- exception- DOCUMENT ME!
- Throws:
- org.xml.sax.SAXException- DOCUMENT ME!
 
 - 
startDTDpublic void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException- Specified by:
- startDTDin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
endDTDpublic void endDTD() throws org.xml.sax.SAXException- Specified by:
- endDTDin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
startEntitypublic void startEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
- startEntityin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
endEntitypublic void endEntity(java.lang.String name) throws org.xml.sax.SAXException- Specified by:
- endEntityin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
startCDATApublic void startCDATA() throws org.xml.sax.SAXException- Specified by:
- startCDATAin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
endCDATApublic void endCDATA() throws org.xml.sax.SAXException- Specified by:
- endCDATAin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
commentpublic void comment(char[] ch, int start, int end) throws org.xml.sax.SAXException- Specified by:
- commentin interface- org.xml.sax.ext.LexicalHandler
- Throws:
- org.xml.sax.SAXException
 
 - 
getElementStackpublic org.dom4j.io.ElementStack getElementStack() 
 - 
setElementStackpublic void setElementStack(org.dom4j.io.ElementStack elementStack) 
 - 
getEntityResolverpublic org.xml.sax.EntityResolver getEntityResolver() 
 - 
setEntityResolverpublic void setEntityResolver(org.xml.sax.EntityResolver entityResolver) 
 - 
getInputSourcepublic org.xml.sax.InputSource getInputSource() 
 - 
setInputSourcepublic void setInputSource(org.xml.sax.InputSource inputSource) 
 - 
isMergeAdjacentTextpublic boolean isMergeAdjacentText() Returns whether adjacent text nodes should be merged together.- Returns:
- Value of property mergeAdjacentText.
 
 - 
setMergeAdjacentTextpublic void setMergeAdjacentText(boolean mergeAdjacentText) Sets whether or not adjacent text nodes should be merged together when parsing.- Parameters:
- mergeAdjacentText- New value of property mergeAdjacentText.
 
 - 
isStripWhitespaceTextpublic boolean isStripWhitespaceText() Sets whether whitespace between element start and end tags should be ignored- Returns:
- Value of property stripWhitespaceText.
 
 - 
setStripWhitespaceTextpublic void setStripWhitespaceText(boolean stripWhitespaceText) Sets whether whitespace between element start and end tags should be ignored.- Parameters:
- stripWhitespaceText- New value of property stripWhitespaceText.
 
 - 
isIgnoreCommentspublic boolean isIgnoreComments() Returns whether we should ignore comments or not.- Returns:
- boolean
 
 - 
setIgnoreCommentspublic void setIgnoreComments(boolean ignoreComments) Sets whether we should ignore comments or not.- Parameters:
- ignoreComments- whether we should ignore comments or not.
 
 - 
completeCurrentTextNodeprotected void completeCurrentTextNode() 
 - 
createDocumentprotected Document createDocument() 
 - 
addDeclaredNamespacesprotected void addDeclaredNamespaces(Element element) 
 - 
addAttributesprotected void addAttributes(Element element, org.xml.sax.Attributes attributes) 
 - 
createElementStackprotected org.dom4j.io.ElementStack createElementStack() 
 - 
attributeNameForNamespaceprotected java.lang.String attributeNameForNamespace(Namespace namespace) 
 
- 
 
-