public class XMLIncluder extends DefaultHandler implements XMLChildrenIncluder
| Constructor and Description |
|---|
XMLIncluder()
Constructor.
|
XMLIncluder(File file)
Constructor.
|
XMLIncluder(InputStream stream)
Constructor.
|
XMLIncluder(URL url)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
endElement(String uri,
String localname,
String qname) |
void |
error(SAXParseException e)
Report an XML parsing error.
|
void |
fatalError(SAXParseException e)
Report a fatal XML parsing error.
|
Charset |
getCharset()
Return the charset to use to write the content.
|
ClassLoader |
getClassLoader()
Return the ClassLoader.
|
String |
getContent()
Return a String representing the XML content.
|
ErrorHandler |
getErrorHandler()
Return the ErrorHandler which will be fired for warnings and errors when parsing the content.
|
StringReader |
getReader()
Return a StringReader to the XML content.
|
boolean |
hasFatalError()
Return true if the parsing of the file threw a Fatal error.
|
boolean |
isAddingComments()
Return true if a comment must be added for each included file.
|
boolean |
isAllowingInternalReaders()
Return true if internal readers creation are allowed in this parser instance.
|
boolean |
isEnablingDeepComments()
Return true if the comments in deep include declarations must be added.
|
void |
setAddComments(boolean addComments,
boolean deep)
Set if a comment must be added for each included file.
|
void |
setAllowInternalReaders(boolean allowInternalReaders)
Set if internal readers creation are allowed in this parser instance.
|
void |
setCharset(Charset charset)
Set the charset to use to write the content.
|
void |
setClassLoader(ClassLoader loader)
Set the ClassLoader.
|
void |
setDefaultBaseDirectory(URL baseDir)
Set the default base directory for including files.
|
void |
setDocumentLocator(Locator locator)
Set the document locator.
|
void |
setErrorHandler(ErrorHandler errorHandler)
Set the ErrorHandler which will be fired for warnings and errors when parsing the content.
|
void |
setFile(File file)
Set the includer file.
|
void |
setInputStream(InputStream stream)
Set the includer InputStream.
|
void |
setURL(URL url)
Set the includer URL.
|
void |
startElement(String uri,
String localname,
String qname,
Attributes attr) |
void |
startPrefixMapping(String prefix,
String uri) |
void |
warning(SAXParseException e)
Report an XML parsing warning.
|
void |
write(File file)
Write the resulting XML to a File.
|
void |
write(URL url)
Write the resulting XML to an URL.
|
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, unparsedEntityDeclclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresetSAXParserFactoryImplementation, setAddComments, setSAXParserFactoryImplementationpublic XMLIncluder()
public XMLIncluder(File file) throws MalformedURLException
file - the fileMalformedURLExceptionpublic XMLIncluder(URL url)
url - the URLpublic XMLIncluder(InputStream stream)
stream - the InputStreampublic void setAllowInternalReaders(boolean allowInternalReaders)
allowInternalReaders - true if internal readers creation are allowed in this parser instance.public boolean isAllowingInternalReaders()
public void setCharset(Charset charset)
StandardCharsets.UTF_8.setCharset in interface XMLChildrenIncludercharset - the charsetpublic Charset getCharset()
getCharset in interface XMLChildrenIncluderpublic void setFile(File file) throws MalformedURLException
setFile in interface XMLChildrenIncluderfile - the fileMalformedURLExceptionpublic void setURL(URL url)
setURL in interface XMLChildrenIncluderurl - the URLpublic void setInputStream(InputStream stream)
setInputStream in interface XMLChildrenIncluderstream - the InputStreampublic void setAddComments(boolean addComments,
boolean deep)
setAddComments in interface XMLChildrenIncluderaddComments - true if a comment must be added for each included filedeep - true if the comments in deep include declarations must be addedpublic boolean isAddingComments()
isAddingComments in interface XMLChildrenIncluderpublic boolean isEnablingDeepComments()
isEnablingDeepComments in interface XMLChildrenIncluderpublic void setClassLoader(ClassLoader loader)
XMLSAXParser.isRevertingOldReaderBehavior() is false.loader - the ClassLoaderpublic ClassLoader getClassLoader()
XMLSAXParser.isRevertingOldReaderBehavior() is false.public void setErrorHandler(ErrorHandler errorHandler)
setErrorHandler in interface XMLChildrenIncludererrorHandler - the ErrorHandlerpublic ErrorHandler getErrorHandler()
getErrorHandler in interface XMLChildrenIncluderpublic boolean hasFatalError()
public void setDefaultBaseDirectory(URL baseDir)
setDefaultBaseDirectory in interface XMLChildrenIncluderbaseDir - the default base directorypublic void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class DefaultHandlerSAXExceptionpublic void fatalError(SAXParseException e)
fatalError in interface ErrorHandlerfatalError in class DefaultHandlerpublic void error(SAXParseException e)
error in interface ErrorHandlererror in class DefaultHandlerpublic void warning(SAXParseException e)
warning in interface ErrorHandlerwarning in class DefaultHandlerpublic void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class DefaultHandlerSAXExceptionpublic void startElement(String uri, String localname, String qname, Attributes attr) throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandlerSAXExceptionpublic void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class DefaultHandlerlocator - the locatorpublic void endElement(String uri, String localname, String qname) throws SAXException
endElement in interface ContentHandlerendElement in class DefaultHandlerSAXExceptionpublic String getContent()
getContent in interface XMLChildrenIncluderpublic void write(URL url) throws IOException
write in interface XMLChildrenIncluderurl - the URLIOExceptionpublic void write(File file) throws IOException
write in interface XMLChildrenIncluderfile - the FileIOExceptionpublic StringReader getReader()
getReader in interface XMLChildrenIncluder