public class XmlStreamReader extends java.lang.Object implements SAXConstants
FEATURE_NAMESPACE_PREFIXES, FEATURE_NAMESPACES, FEATURE_VALIDATING
Modifier and Type | Method and Description |
---|---|
protected static org.xml.sax.InputSource |
createInputSource(java.lang.String uri,
java.io.InputStream stream,
java.nio.charset.Charset charset) |
protected static org.xml.sax.InputSource |
createInputSource(java.lang.String uri,
java.io.Reader reader) |
protected static void |
initInputSource(org.xml.sax.InputSource source,
java.lang.String uri,
java.nio.charset.Charset charset) |
static org.w3c.dom.Document |
loadDOM(org.xml.sax.InputSource source,
boolean validating)
Read the given source with an XML parser and return the DOM tree structure.
|
static org.w3c.dom.Document |
loadDOM(java.io.InputStream xmlStream,
java.lang.String uri,
boolean validating)
Read the given stream with an XML parser and return the DOM tree structure.
|
static Element |
loadFrom(org.xml.sax.InputSource source,
boolean validating)
Read the given input source with an XML parser and return the element
structure.
|
static Element |
loadFrom(java.io.InputStream xmlStream)
Read the given stream with an XML parser and return the element structure.
|
static Element |
loadFrom(java.io.InputStream xmlStream,
boolean validating)
Read the given stream with an XML parser and return the element structure.
|
static Element |
loadFrom(java.io.InputStream xmlStream,
java.lang.String uri,
boolean validating)
Read the given stream with an XML parser and return the element structure.
|
static XmlDocument |
loadXmlFrom(org.xml.sax.InputSource source,
boolean validating)
Read the given input source with an XML parser and return the element
structure.
|
protected static Logger |
logger()
Returns the current logger used by this component to report
errors and exceptions.
|
static org.w3c.dom.Document |
readDOM(java.io.File file,
boolean validating)
Read the given file as XML stream and return the DOM tree structure.
|
static org.w3c.dom.Document |
readDOM(java.io.InputStream xmlStream,
java.lang.String uri,
boolean validating)
Read the given stream with an XML parser and return the DOM tree structure.
|
static org.w3c.dom.Document |
readDOM(java.lang.String xmlFileName)
Read the file with the given name as XML stream and return the DOM
tree structure.
|
static org.w3c.dom.Document |
readDOM(java.lang.String xmlFileName,
boolean validating)
Read the file with the given name as XML stream and return the DOM
tree structure.
|
static Element |
readFrom(java.io.File file,
boolean validating)
Read the given file as XML stream and return the element structure.
|
static Element |
readFrom(java.io.InputStream xmlStream)
Read the given stream with an XML parser and return the element structure.
|
static Element |
readFrom(java.io.InputStream xmlStream,
boolean validating)
Read the given stream with an XML parser and return the element structure.
|
static Element |
readFrom(java.io.InputStream xmlStream,
java.lang.String uri,
boolean validating)
Read the given stream with an XML parser and return the element structure.
|
static Element |
readFrom(java.lang.String xmlFileName)
Read the file with the given name as XML stream and return the element
structure.
|
static Element |
readFrom(java.lang.String xmlFileName,
boolean validating)
Read the file with the given name as XML stream and return the element
structure.
|
static XmlDocument |
readXmlFrom(java.io.File file,
java.nio.charset.Charset charset,
boolean validating)
Read the given file with an XML parser and return the element structure.
|
static XmlDocument |
readXmlFrom(org.xml.sax.InputSource source,
boolean validating)
Read the given source with an XML SAX parser and return the XML document.
|
static XmlDocument |
readXmlFrom(java.io.InputStream xmlStream,
java.nio.charset.Charset charset,
java.lang.String uri,
boolean validating)
Read the given stream with an XML parser and return the element structure.
|
static XmlDocument |
readXmlFrom(java.io.Reader reader,
java.lang.String uri,
boolean validating)
Read the given stream with an XML parser and return the element structure.
|
static XmlDocument |
readXmlFrom(java.lang.String filename,
java.nio.charset.Charset charset,
boolean validating)
Read the file with the given filename using an XML SAX parser and return the
document.
|
static XmlDocument |
readXmlFromText(java.lang.String xmlText)
Read the given text with an XML parser and return the element structure.
|
public static Element readFrom(java.lang.String xmlFileName)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlFileName
- The name of the file to readpublic static Element readFrom(java.lang.String xmlFileName, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlFileName
- The name of the file to readvalidating
- if true the parser will validate against any defined DTDpublic static Element readFrom(java.io.File file, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
file
- The file to readvalidating
- if true the parser will validate against any defined DTDpublic static Element readFrom(java.io.InputStream xmlStream, java.lang.String uri, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlStream
- The XML stream to readuri
- The URI of the streamvalidating
- if true the parser will validate against any defined DTDpublic static XmlDocument readXmlFrom(java.lang.String filename, java.nio.charset.Charset charset, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
filename
- The name of the file to read the XML from (must not be null).charset
- The character encoding to be used when reading the file (may be null).validating
- if true the parser will validate against any defined DTD.public static XmlDocument readXmlFrom(java.io.File file, java.nio.charset.Charset charset, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
file
- The file to read the XML from (must not be null).charset
- The character encoding to be used when reading the file (may be null).validating
- if true the parser will validate against any defined DTD.public static XmlDocument readXmlFrom(java.io.Reader reader, java.lang.String uri, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
reader
- The reader to get the XML from (must not be null).uri
- The URI of the stream (may be null).validating
- if true the parser will validate against any defined DTD.public static XmlDocument readXmlFrom(java.io.InputStream xmlStream, java.nio.charset.Charset charset, java.lang.String uri, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlStream
- The stream to read the XML from (must not be null).uri
- The URI of the stream (may be null).charset
- The character encoding to be used when reading the XML (may be null).validating
- if true the parser will validate against any defined DTD.public static XmlDocument readXmlFrom(org.xml.sax.InputSource source, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
source
- Defines where the XML can be found.validating
- if true the parser will validate against any defined DTDpublic static XmlDocument readXmlFromText(java.lang.String xmlText)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlText
- The text to read the XML from (must not be null).public static org.w3c.dom.Document readDOM(java.lang.String xmlFileName)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlFileName
- The name of the file to readpublic static org.w3c.dom.Document readDOM(java.lang.String xmlFileName, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlFileName
- The name of the file to readvalidating
- if true the parser will validate against any defined DTDpublic static org.w3c.dom.Document readDOM(java.io.File file, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
file
- The file to readvalidating
- if true the parser will validate against any defined DTDpublic static org.w3c.dom.Document readDOM(java.io.InputStream xmlStream, java.lang.String uri, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlStream
- The XML stream to readuri
- The URI of the streamvalidating
- if true the parser will validate against any defined DTDpublic static Element readFrom(java.io.InputStream xmlStream, boolean validating)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlStream
- The XML stream to readvalidating
- if true the parser will validate against any defined DTDpublic static Element readFrom(java.io.InputStream xmlStream)
All exceptions will be caught and logged using the current component logger
(see LoggerProvider
).
xmlStream
- The XML stream to readpublic static Element loadFrom(java.io.InputStream xmlStream) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
xmlStream
- The XML stream to readjava.io.IOException
- If anything is wrong with reading the streamjavax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for detailsorg.xml.sax.SAXException
- See org.xml.sax for detailspublic static Element loadFrom(java.io.InputStream xmlStream, boolean validating) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
xmlStream
- The XML stream to readvalidating
- if true the parser will validate against any defined DTDjava.io.IOException
- If anything is wrong with reading the streamjavax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for detailsorg.xml.sax.SAXException
- See org.xml.sax for detailspublic static Element loadFrom(java.io.InputStream xmlStream, java.lang.String uri, boolean validating) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
xmlStream
- The XML stream to readuri
- The URI of the streamvalidating
- if true the parser will validate against any defined DTDjava.io.IOException
- If anything is wrong with reading the streamjavax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for detailsorg.xml.sax.SAXException
- See org.xml.sax for detailspublic static Element loadFrom(org.xml.sax.InputSource source, boolean validating) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
source
- The input source that contains the XML stream to readvalidating
- if true the parser will validate against any defined DTDjava.io.IOException
- If anything is wrong with reading the streamjavax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for detailsorg.xml.sax.SAXException
- See org.xml.sax for detailspublic static XmlDocument loadXmlFrom(org.xml.sax.InputSource source, boolean validating) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
source
- The input source that contains the XML stream to readvalidating
- if true the parser will validate against any defined DTDjava.io.IOException
- If anything is wrong with reading the streamjavax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for detailsorg.xml.sax.SAXException
- See org.xml.sax for detailspublic static org.w3c.dom.Document loadDOM(java.io.InputStream xmlStream, java.lang.String uri, boolean validating) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
xmlStream
- The XML stream to read.uri
- The URI of the stream.validating
- if true the parser will validate against any defined DTD.java.io.IOException
- If anything is wrong with reading the stream.javax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for details.org.xml.sax.SAXException
- See org.xml.sax for details.public static org.w3c.dom.Document loadDOM(org.xml.sax.InputSource source, boolean validating) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
source
- The input source that contains the XML stream to readvalidating
- if true the parser will validate against any defined DTDjava.io.IOException
- If anything is wrong with reading the streamjavax.xml.parsers.ParserConfigurationException
- See javax.xml.parsers for detailsorg.xml.sax.SAXException
- See org.xml.sax for detailsprotected static Logger logger()
protected static org.xml.sax.InputSource createInputSource(java.lang.String uri, java.io.InputStream stream, java.nio.charset.Charset charset)
protected static org.xml.sax.InputSource createInputSource(java.lang.String uri, java.io.Reader reader)
protected static void initInputSource(org.xml.sax.InputSource source, java.lang.String uri, java.nio.charset.Charset charset)