public class XMLNodeIncluder extends Object implements XMLChildrenIncluder
Constructor and Description |
---|
XMLNodeIncluder()
Constructor.
|
XMLNodeIncluder(boolean keepAttributesOrder)
Constructor.
|
XMLNodeIncluder(File file)
Constructor.
|
XMLNodeIncluder(File file,
boolean keepAttributesOrder)
Constructor.
|
XMLNodeIncluder(InputStream stream)
Constructor.
|
XMLNodeIncluder(InputStream stream,
boolean keepAttributesOrder)
Constructor.
|
XMLNodeIncluder(URL url)
Constructor.
|
XMLNodeIncluder(URL url,
boolean keepAttributesOrder)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Charset |
getCharset()
Return the charset to use to write the content.
|
String |
getContent()
Return a String representing the XML content.
|
EntityListResolver |
getEntityListResolver()
Return the EntityListResolver which can manage entity resolution in XML files.
|
ErrorHandler |
getErrorHandler()
Return the ErrorHandler which will be fired for warnings and errors when parsing the content.
|
int |
getIndentation()
Return the indentation.
|
Reader |
getReader()
Return a Reader to the XML content.
|
boolean |
isAddingComments()
Return true if a comment must be added for each included file.
|
boolean |
isEnablingDeepComments()
Return true if the comments in deep include declarations must be added.
|
boolean |
isKeepingAttributesOrder()
Return true if the order of attributes is kept in the output.
|
boolean |
isKeepingPrefixes()
Return true if the underlying parser must keep the prefixes.
|
void |
keepAttributesOrder(boolean keepAttributesOrder)
Set if the order of attributes is kept in the output.
|
void |
setAddComments(boolean addComments,
boolean deep)
Set if a comment must be added for each included file.
|
void |
setCharset(Charset charset)
Set the charset to use to write the content.
|
void |
setDefaultBaseDirectory(URL baseDir)
Set the default base directory for including files.
|
void |
setEntityListResolver(EntityListResolver resolver)
Set the EntityListResolver which can manage entity resolution in XML files.
|
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 |
setIndentation(int indentation)
Set the indentation.
|
void |
setInputStream(InputStream stream)
Set the includer InputStream.
|
void |
setKeepPrefixes(boolean keepPrefixes)
Set if the underlying parser must keep the prefixes.
|
void |
setURL(URL url)
Set the includer URL.
|
void |
skipAllPrefixes(boolean skip)
Set true if all the prefixes in the included children must be skipped.
|
void |
skipPrefixes(Set<String> prefixes)
Set a list of prefixes to skip.
|
void |
skipPrefixes(String... prefixes)
Set a list of prefixes to skip.
|
void |
write(File file)
Write the resulting XML to a File.
|
void |
write(URL url)
Write the resulting XML to an URL.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resetSAXParserFactoryImplementation, setAddComments, setSAXParserFactoryImplementation
public XMLNodeIncluder()
public XMLNodeIncluder(boolean keepAttributesOrder)
keepAttributesOrder
- true if the order of the attributes is kept in the outputpublic XMLNodeIncluder(File file, boolean keepAttributesOrder) throws MalformedURLException
file
- the filekeepAttributesOrder
- true if the order of the attributes is kept in the outputMalformedURLException
public XMLNodeIncluder(URL url, boolean keepAttributesOrder)
url
- the URLkeepAttributesOrder
- true if the order of the attributes is kept in the outputpublic XMLNodeIncluder(InputStream stream, boolean keepAttributesOrder)
stream
- the InputStreamkeepAttributesOrder
- true if the order of the attributes is kept in the outputpublic XMLNodeIncluder(File file) throws MalformedURLException
file
- the fileMalformedURLException
public XMLNodeIncluder(URL url)
url
- the URLpublic XMLNodeIncluder(InputStream stream)
stream
- the InputStreampublic void keepAttributesOrder(boolean keepAttributesOrder)
keepAttributesOrder
- true if the order of attributes is kept in the outputpublic boolean isKeepingAttributesOrder()
public void setCharset(Charset charset)
StandardCharsets.UTF_8
.setCharset
in interface XMLChildrenIncluder
charset
- the charsetpublic Charset getCharset()
getCharset
in interface XMLChildrenIncluder
public void setFile(File file) throws MalformedURLException
setFile
in interface XMLChildrenIncluder
file
- the fileMalformedURLException
public void setURL(URL url)
setURL
in interface XMLChildrenIncluder
url
- the URLpublic void setInputStream(InputStream stream)
setInputStream
in interface XMLChildrenIncluder
stream
- the InputStreampublic void skipAllPrefixes(boolean skip)
skip
- true if all the prefixes in the included children must be skippedpublic void skipPrefixes(String... prefixes)
prefixes
- the prefixespublic void skipPrefixes(Set<String> prefixes)
prefixes
- the prefixespublic void setAddComments(boolean addComments, boolean deep)
setAddComments
in interface XMLChildrenIncluder
addComments
- 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 XMLChildrenIncluder
public boolean isEnablingDeepComments()
isEnablingDeepComments
in interface XMLChildrenIncluder
public void setKeepPrefixes(boolean keepPrefixes)
keepPrefixes
- true if the parser must keep the prefixespublic boolean isKeepingPrefixes()
public void setEntityListResolver(EntityListResolver resolver)
resolver
- the resolverpublic EntityListResolver getEntityListResolver()
public void setErrorHandler(ErrorHandler errorHandler)
setErrorHandler
in interface XMLChildrenIncluder
errorHandler
- the ErrorHandlerpublic ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLChildrenIncluder
public void setDefaultBaseDirectory(URL baseDir)
setDefaultBaseDirectory
in interface XMLChildrenIncluder
baseDir
- the default base directorypublic void setIndentation(int indentation)
indentation
- the indentationpublic int getIndentation()
public String getContent()
getContent
in interface XMLChildrenIncluder
public Reader getReader()
XMLChildrenIncluder
getReader
in interface XMLChildrenIncluder
public void write(File file) throws IOException
XMLChildrenIncluder
write
in interface XMLChildrenIncluder
file
- the FileIOException
public void write(URL url) throws IOException
XMLChildrenIncluder
write
in interface XMLChildrenIncluder
url
- the URLIOException