Package org.dom4j.io
Class DOMSAXContentHandler
- java.lang.Object
 - 
- org.xml.sax.helpers.DefaultHandler
 - 
- org.dom4j.io.DOMSAXContentHandler
 
 
 
- 
- All Implemented Interfaces:
 ContentHandler,DTDHandler,EntityResolver,ErrorHandler,LexicalHandler
public class DOMSAXContentHandler extends DefaultHandler implements LexicalHandler
SAXContentHandlerbuilds W3C DOM object via SAX events. 
- 
- 
Constructor Summary
Constructors Constructor Description DOMSAXContentHandler()DOMSAXContentHandler(DOMDocumentFactory documentFactory) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 voidcompleteCurrentTextNode()protected DocumentcreateDocument()protected org.dom4j.io.ElementStackcreateElementStack()voidendCDATA()voidendDocument()voidendDTD()voidendElement(String namespaceURI, String localName, String qName)voidendEntity(String name)voidendPrefixMapping(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.DocumentgetDocument()Retrieves w3c document object built via generated sax events.org.dom4j.io.ElementStackgetElementStack()EntityResolvergetEntityResolver()InputSourcegetInputSource()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(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.voidstartCDATA()voidstartDocument()voidstartDTD(String name, String publicId, String systemId)voidstartElement(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 org.xml.sax.helpers.DefaultHandler
ignorableWhitespace, notationDecl, resolveEntity, skippedEntity, unparsedEntityDecl 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
DOMSAXContentHandler
public DOMSAXContentHandler()
 
- 
DOMSAXContentHandler
public DOMSAXContentHandler(DOMDocumentFactory documentFactory)
 
 - 
 
- 
Method Detail
- 
getDocument
public Document getDocument()
Retrieves w3c document object built via generated sax events.- Returns:
 - the document that has been or is being built
 
 
- 
setDocumentLocator
public void setDocumentLocator(Locator documentLocator)
- Specified by:
 setDocumentLocatorin interfaceContentHandler- Overrides:
 setDocumentLocatorin classDefaultHandler
 
- 
processingInstruction
public void processingInstruction(String target, String data) throws SAXException
- Specified by:
 processingInstructionin interfaceContentHandler- Overrides:
 processingInstructionin classDefaultHandler- Throws:
 SAXException
 
- 
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
 startPrefixMappingin interfaceContentHandler- Overrides:
 startPrefixMappingin classDefaultHandler- Throws:
 SAXException
 
- 
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
 endPrefixMappingin interfaceContentHandler- Overrides:
 endPrefixMappingin classDefaultHandler- Throws:
 SAXException
 
- 
startDocument
public void startDocument() throws SAXException- Specified by:
 startDocumentin interfaceContentHandler- Overrides:
 startDocumentin classDefaultHandler- Throws:
 SAXException
 
- 
endDocument
public void endDocument() throws SAXException- 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
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
- Specified by:
 endElementin interfaceContentHandler- Overrides:
 endElementin classDefaultHandler- Throws:
 SAXException
 
- 
characters
public void characters(char[] ch, int start, int end) throws SAXException- Specified by:
 charactersin interfaceContentHandler- Overrides:
 charactersin classDefaultHandler- Throws:
 SAXException
 
- 
warning
public void warning(SAXParseException exception) throws SAXException
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
public void error(SAXParseException exception) throws SAXException
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
public void fatalError(SAXParseException exception) throws SAXException
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
public void startDTD(String name, String publicId, String systemId) throws SAXException
- Specified by:
 startDTDin interfaceLexicalHandler- Throws:
 SAXException
 
- 
endDTD
public void endDTD() throws SAXException- Specified by:
 endDTDin interfaceLexicalHandler- Throws:
 SAXException
 
- 
startEntity
public void startEntity(String name) throws SAXException
- Specified by:
 startEntityin interfaceLexicalHandler- Throws:
 SAXException
 
- 
endEntity
public void endEntity(String name) throws SAXException
- Specified by:
 endEntityin interfaceLexicalHandler- Throws:
 SAXException
 
- 
startCDATA
public void startCDATA() throws SAXException- Specified by:
 startCDATAin interfaceLexicalHandler- Throws:
 SAXException
 
- 
endCDATA
public void endCDATA() throws SAXException- Specified by:
 endCDATAin interfaceLexicalHandler- Throws:
 SAXException
 
- 
comment
public void comment(char[] ch, int start, int end) throws SAXException- Specified by:
 commentin interfaceLexicalHandler- Throws:
 SAXException
 
- 
getElementStack
public org.dom4j.io.ElementStack getElementStack()
 
- 
setElementStack
public void setElementStack(org.dom4j.io.ElementStack elementStack)
 
- 
getEntityResolver
public EntityResolver getEntityResolver()
 
- 
setEntityResolver
public void setEntityResolver(EntityResolver entityResolver)
 
- 
getInputSource
public InputSource getInputSource()
 
- 
setInputSource
public void setInputSource(InputSource inputSource)
 
- 
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
protected Document createDocument()
 
- 
addDeclaredNamespaces
protected void addDeclaredNamespaces(Element element)
 
- 
addAttributes
protected void addAttributes(Element element, Attributes attributes)
 
- 
createElementStack
protected org.dom4j.io.ElementStack createElementStack()
 
 - 
 
 -