public class XmlDataReader
extends java.lang.Object
It is possible, during loading, to:
| Modifier and Type | Class | Description |
|---|---|---|
static class |
XmlDataReader.Feature |
| Modifier and Type | Field | Description |
|---|---|---|
protected AttributePredicate |
attributeFilter |
The filter attributes.
|
protected AttributeNameConverter |
attributeNameConverter |
Attribute name converter.
|
protected AttributeValueConverter |
attributeValueConverter |
Attribute value converter.
|
static cdc.util.lang.Cache<java.lang.String> |
CACHE |
The cache of strings used to share attributes and elements names.
|
protected ElementNameConverter |
elementNameConverter |
Element name converter.
|
protected ElementPredicate |
elementPostFilter |
The filter to use when all the children of an element are created.
|
protected ElementPredicate |
elementPreFilter |
The filter to use when the element is created.
|
protected org.xml.sax.EntityResolver |
entityResolver |
The entity resolver.
|
protected static org.apache.logging.log4j.Logger |
LOGGER |
|
protected TextContentConverter |
textContentConverter |
Text content converter.
|
| Constructor | Description |
|---|---|
XmlDataReader() |
| Modifier and Type | Method | Description |
|---|---|---|
static XmlDataReader |
create(XmlDataReader.Feature... features) |
|
AttributePredicate |
getAttributeFilter() |
|
AttributeNameConverter |
getAttributeNameConverter() |
|
AttributeValueConverter |
getAttributeValueConverter() |
|
ElementNameConverter |
getElementNameConverter() |
|
ElementPredicate |
getElementPostFilter() |
|
ElementPredicate |
getElementPreFilter() |
|
org.xml.sax.EntityResolver |
getEntityResolver() |
|
TextContentConverter |
getTextContentConverter() |
|
boolean |
isEnabled(XmlDataReader.Feature feature) |
Returns
true when a feature is enabled. |
static Document |
load(java.io.File file,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
static Document |
load(java.io.File file,
XmlDataReader.Feature... features) |
|
static Document |
load(java.io.InputStream is,
XmlDataReader.Feature... features) |
|
static Document |
load(java.io.InputStream is,
java.lang.String systemId,
XmlDataReader.Feature... features) |
|
static Document |
load(java.lang.String filename,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
static Document |
load(java.lang.String filename,
XmlDataReader.Feature... features) |
|
static Document |
load(java.lang.String s,
java.nio.charset.Charset charset,
XmlDataReader.Feature... features) |
|
static Document |
load(java.net.URL url,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
static Document |
load(java.net.URL url,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.io.File file,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.io.File file,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.io.InputStream is,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.io.InputStream is,
java.lang.String systemId,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.lang.String filename,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.lang.String filename,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.lang.String s,
java.nio.charset.Charset charset,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.net.URL url,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
static Element |
loadRoot(java.net.URL url,
XmlDataReader.Feature... features) |
|
Document |
read(java.io.File file) |
Reads a file.
|
Document |
read(java.io.File file,
cdc.util.compress.Compressor compressor) |
Reads a file.
|
Document |
read(java.io.InputStream is) |
|
Document |
read(java.io.InputStream is,
java.lang.String systemId) |
Reads an InputStream.
|
Document |
read(java.lang.String filename) |
Reads a file.
|
Document |
read(java.lang.String filename,
cdc.util.compress.Compressor compressor) |
Reads a file.
|
Document |
read(java.lang.String s,
java.nio.charset.Charset charset) |
Reads a string.
|
Document |
read(java.net.URL url) |
Reads an URL.
|
Document |
read(java.net.URL url,
cdc.util.compress.Compressor compressor) |
Reads an URL.
|
Element |
readRoot(java.io.File file) |
Reads a file.
|
Element |
readRoot(java.io.File file,
cdc.util.compress.Compressor compressor) |
Reads a file.
|
Element |
readRoot(java.io.InputStream is) |
|
Element |
readRoot(java.io.InputStream is,
java.lang.String systemId) |
Reads an InputStream.
|
Element |
readRoot(java.lang.String filename) |
Reads a file.
|
Element |
readRoot(java.lang.String filename,
cdc.util.compress.Compressor compressor) |
Reads a file.
|
Element |
readRoot(java.lang.String s,
java.nio.charset.Charset charset) |
Reads a string.
|
Element |
readRoot(java.net.URL url) |
Reads an URL.
|
Element |
readRoot(java.net.URL url,
cdc.util.compress.Compressor compressor) |
Reads an URL.
|
void |
setAttributeFilter(AttributePredicate filter) |
Sets the attribute filter.
|
void |
setAttributeNameConverter(AttributeNameConverter converter) |
Sets the attribute name converter.
|
void |
setAttributeValueConverter(AttributeValueConverter converter) |
Sets the attribute value converter.
|
void |
setElementNameConverter(ElementNameConverter converter) |
Sets the element name converter.
|
void |
setElementPostFilter(ElementPredicate filter) |
Sets the element post filter.
|
void |
setElementPreFilter(ElementPredicate filter) |
Sets the element pre filter.
|
void |
setEnabled(XmlDataReader.Feature feature,
boolean enabled) |
Enables or disables a feature.
|
void |
setEntityResolver(org.xml.sax.EntityResolver resolver) |
Sets the entity resolver.
|
void |
setTextContentConverter(TextContentConverter converter) |
public static final cdc.util.lang.Cache<java.lang.String> CACHE
protected static final org.apache.logging.log4j.Logger LOGGER
protected org.xml.sax.EntityResolver entityResolver
protected AttributePredicate attributeFilter
Only accepted attributes are kept and transformed.
protected AttributeNameConverter attributeNameConverter
Applied on accepted attributes.
protected AttributeValueConverter attributeValueConverter
Applied on accepted attributes.
protected ElementPredicate elementPreFilter
protected ElementPredicate elementPostFilter
protected ElementNameConverter elementNameConverter
Applied on elements that are pre accepted.
protected TextContentConverter textContentConverter
public boolean isEnabled(XmlDataReader.Feature feature)
true when a feature is enabled.feature - The feature.true if feature is enabled.public void setEnabled(XmlDataReader.Feature feature, boolean enabled)
feature - The feature.enabled - If true, the feature is enabled. It is disabled orthewise.public org.xml.sax.EntityResolver getEntityResolver()
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
WARNING: This has interactions with XmlDataReader.Feature.DUMMY_ENTITY_RESOLVER.
resolver - The entity resolver.public AttributePredicate getAttributeFilter()
public void setAttributeFilter(AttributePredicate filter)
The name and value that are passed to the filter are the original name and value, before any name or value conversion happens.
filter - The filter.java.lang.IllegalArgumentException - When filter is null.public AttributeNameConverter getAttributeNameConverter()
public void setAttributeNameConverter(AttributeNameConverter converter)
The conversion is applied after attribute filtering.
converter - The converter.java.lang.IllegalArgumentException - When converter is null.public AttributeValueConverter getAttributeValueConverter()
public void setAttributeValueConverter(AttributeValueConverter converter)
The conversion is applied after attribute filtering.
converter - The converter.java.lang.IllegalArgumentException - When converter is null.public ElementPredicate getElementPreFilter()
public void setElementPreFilter(ElementPredicate filter)
WARNING:
filter - The filter.java.lang.IllegalArgumentException - When filter is null.public ElementPredicate getElementPostFilter()
public void setElementPostFilter(ElementPredicate filter)
WARNING:
filter - The filter.java.lang.IllegalArgumentException - When filter is null.public ElementNameConverter getElementNameConverter()
public void setElementNameConverter(ElementNameConverter converter)
converter - The converter.java.lang.IllegalArgumentException - When converter is null.public TextContentConverter getTextContentConverter()
public void setTextContentConverter(TextContentConverter converter)
public Document read(java.io.InputStream is) throws java.io.IOException
java.io.IOExceptionpublic Element readRoot(java.io.InputStream is) throws java.io.IOException
java.io.IOExceptionpublic Document read(java.io.InputStream is, java.lang.String systemId) throws java.io.IOException
is - The InputStream.systemId - The systemId which is needed for resolving relative URIs.java.io.IOException - When an IO error occurs.public Element readRoot(java.io.InputStream is, java.lang.String systemId) throws java.io.IOException
is - The InputStream.systemId - The systemId which is needed for resolving relative URIs.java.io.IOException - When an IO error occurs.public Document read(java.lang.String s, java.nio.charset.Charset charset) throws java.io.IOException
s - The string.charset - The charset. Must be compliant with string content.java.io.IOException - When an IO error occurs.public Element readRoot(java.lang.String s, java.nio.charset.Charset charset) throws java.io.IOException
s - The string.charset - The charset. Must be compliant with string content.java.io.IOException - When an IO error occurs.public Document read(java.net.URL url, cdc.util.compress.Compressor compressor) throws java.io.IOException
url - The URL.compressor - The compressor used to compress file.java.io.IOException - When an IO error occurs.public Document read(java.net.URL url) throws java.io.IOException
url - The URL.java.io.IOException - When an IO error occurs.public Element readRoot(java.net.URL url, cdc.util.compress.Compressor compressor) throws java.io.IOException
url - The URL.compressor - The compressor used to compress file.java.io.IOException - When an IO error occurs.public Element readRoot(java.net.URL url) throws java.io.IOException
url - The URL.java.io.IOException - When an IO error occurs.public Document read(java.lang.String filename, cdc.util.compress.Compressor compressor) throws java.io.IOException
filename - The file name.compressor - The compressor used to compress file.java.io.IOException - When an IO error occurs.public Document read(java.lang.String filename) throws java.io.IOException
filename - The file name.java.io.IOException - When an IO error occurs.public Element readRoot(java.lang.String filename, cdc.util.compress.Compressor compressor) throws java.io.IOException
filename - The file name.compressor - The compressor used to compress file.java.io.IOException - When an IO error occurs.public Element readRoot(java.lang.String filename) throws java.io.IOException
filename - The file name.java.io.IOException - When an IO error occurs.public Document read(java.io.File file, cdc.util.compress.Compressor compressor) throws java.io.IOException
file - The file.compressor - The compressor used to compress file.java.io.IOException - When an IO error occurs.public Document read(java.io.File file) throws java.io.IOException
file - The file.java.io.IOException - When an IO error occurs.public Element readRoot(java.io.File file, cdc.util.compress.Compressor compressor) throws java.io.IOException
file - The file.compressor - The compressor used to compress file.java.io.IOException - When an IO error occurs.public Element readRoot(java.io.File file) throws java.io.IOException
file - The file.java.io.IOException - When an IO error occurs.public static XmlDataReader create(XmlDataReader.Feature... features)
public static Document load(java.io.InputStream is, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.io.InputStream is, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.io.InputStream is, java.lang.String systemId, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.io.InputStream is, java.lang.String systemId, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.lang.String s, java.nio.charset.Charset charset, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.lang.String s, java.nio.charset.Charset charset, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.net.URL url, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.net.URL url, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.net.URL url, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.net.URL url, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.lang.String filename, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.lang.String filename, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.lang.String filename, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.lang.String filename, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.io.File file, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Document load(java.io.File file, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.io.File file, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic static Element loadRoot(java.io.File file, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionCopyright © 2019. All rights reserved.