public class XMLTreeHandler extends ResolverSAXHandler
ResolverSAXHandler.ExceptionResult, ResolverSAXHandler.InformationResult, ResolverSAXHandler.SourceWrapper
CACHE_DEFAULT, dtd, ERRORS, FATAL, INFO, locator, NO_ERRORS, publicDTD, resolver, results, status, WARNINGS
CACHING_DEFAULT, CACHING_SOURCES, NOT_CACHING_SOURCES
Constructor and Description |
---|
XMLTreeHandler()
Constructor.
|
XMLTreeHandler(boolean asRoot)
Constructor.
|
XMLTreeHandler(String encoding)
Constructor.
|
XMLTreeHandler(String encoding,
boolean asRoot)
Constructor.
|
XMLTreeHandler(String encoding,
boolean asRoot,
String comment)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] chararacters,
int start,
int length) |
protected XMLNode |
createNodeImpl(QName qname,
Attributes attr)
Create a node.
|
void |
endElement(String uri,
String localname,
String qname) |
void |
endPrefixMapping(String prefix) |
protected void |
errorImpl(SAXParseException e)
Do nothing by default.
|
protected void |
fatalErrorImpl(SAXParseException e)
Do nothing.
|
protected XMLNode |
getCurrentNode()
Return the current node.
|
ErrorHandler |
getErrorHandler()
Return the error handler wich will be fired for parsing errors detected by the parser. null by default.
|
XMLRoot |
getRoot()
Return the root node, as a
XMLRoot . |
XMLNode |
getRootNode()
Return the root node.
|
boolean |
isKeepingLineNumbers()
Return true if line numbers in the XML File are kept.
|
boolean |
isPreservingSpace()
Return true if space characters must be preserved.
|
void |
preserveSpace(boolean preserveSpace)
Set if space characters must be preserved.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Set an error handler wich will be fired for parsing errors detected by the parser.
|
void |
setKeepLineNumbers(boolean keepLineNumbers)
Set if line numbers in the XML File are kept.
|
void |
startElement(String uri,
String localname,
String qname,
Attributes attr)
Receive notification of the beginning of an element.
|
void |
startPrefixMapping(String prefix,
String uri) |
protected void |
warningImpl(SAXParseException e)
Do nothing.
|
endDocument, endDTD, error, error, fatalError, fatalError, getDocumentBaseURL, getDocumentLocator, getDTD, getEntityResolver, getExceptionResults, getExceptions, getExceptionsResultsByLine, getExternalSubset, getFirstException, getInputSourceCaching, getStatus, hasErrors, hasParserExceptions, hasStartedElements, info, info, isDocumentStarted, isElementStarted, reset, resolveEntity, resolveEntity, resolveResource, restart, setDocumentLocator, setDTD, setEntityResolver, setInputSourceCaching, setStatus, startDocument, warning, warning
attributeDecl, comment, elementDecl, endCDATA, endEntity, externalEntityDecl, internalEntityDecl, startCDATA, startDTD, startEntity
ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, unparsedEntityDecl
public XMLTreeHandler()
public XMLTreeHandler(boolean asRoot)
asRoot
- true if the root node must be a XMLRoot
.public XMLTreeHandler(String encoding)
encoding
- the encoding of the XML filepublic XMLTreeHandler(String encoding, boolean asRoot)
encoding
- the encoding of the XML fileasRoot
- true if the root node must be a XMLRoot
.public void setErrorHandler(ErrorHandler errorHandler)
errorHandler
- the error handlerpublic ErrorHandler getErrorHandler()
public void preserveSpace(boolean preserveSpace)
preserveSpace
- true if space characters must be preservedpublic boolean isPreservingSpace()
public void setKeepLineNumbers(boolean keepLineNumbers)
keepLineNumbers
- true if line numbers in the XML File are keptpublic boolean isKeepingLineNumbers()
public XMLNode getRootNode()
public void startElement(String uri, String localname, String qname, Attributes attr) throws SAXException
startElement
in interface ContentHandler
startElement
in class ResolverSAXHandler
uri
- the Namespace URIlocalname
- the local name (without prefix), or the empty string if Namespace processing is not being performedqname
- The qualified name (with prefix), or the empty string if qualified names are not availableattr
- the specified or defaulted attributesSAXException
public void endElement(String uri, String localname, String qname)
endElement
in interface ContentHandler
endElement
in class DefaultHandler
public void characters(char[] chararacters, int start, int length)
characters
in interface ContentHandler
characters
in class DefaultHandler
protected XMLNode getCurrentNode()
public void startPrefixMapping(String prefix, String uri)
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
public void endPrefixMapping(String prefix)
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
protected XMLNode createNodeImpl(QName qname, Attributes attr)
qname
- the qualified name of the nodeattr
- the node attributesprotected void fatalErrorImpl(SAXParseException e)
ResolverSAXHandler.fatalError(org.xml.sax.SAXParseException)
.fatalErrorImpl
in class ResolverSAXHandler
e
- the SAXParseExceptionprotected void errorImpl(SAXParseException e)
ResolverSAXHandler.error(org.xml.sax.SAXParseException)
.errorImpl
in class ResolverSAXHandler
e
- the SAXParseExceptionprotected void warningImpl(SAXParseException e)
ResolverSAXHandler.warning(org.xml.sax.SAXParseException)
.warningImpl
in class ResolverSAXHandler
e
- the SAXParseException