public class XMLIO extends Object
Modifier and Type | Class and Description |
---|---|
static class |
XMLIO.XMLIOException
Exception raised when an IO exception occurs or if the underlying XML reader yields an error.
|
Constructor and Description |
---|
XMLIO(FileAsStream fileAsStream) |
Modifier and Type | Method and Description |
---|---|
protected static Document |
read(InputSource input)
Reads an XML document from a SAX source.
|
protected static Document |
read(InputStream input)
Reads an XML document from an stream.
|
protected static Document |
read(Reader input)
Reads an XML document using a
Reader . |
Document |
read(String filename)
Reads an XML document from the file specified by
filename . |
static Document |
readFromString(String input)
Reads an XML document from a
String . |
void |
write(String filename,
Document document)
Outputs the given
document into the file filename . |
static void |
write(Writer out,
Document doc)
Outputs the given
document using the given Writer . |
static String |
writeToString(Document doc)
Outputs the given
document into a String . |
public XMLIO(FileAsStream fileAsStream)
public void write(String filename, Document document) throws XMLIO.XMLIOException
document
into the file filename
.filename
- destination filedocument
- to be written in filename
XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.public static void write(Writer out, Document doc) throws XMLIO.XMLIOException
document
using the given Writer
.out
- the Writer objectdoc
- the document that has to be written using the Writer
.XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.public static String writeToString(Document doc) throws XMLIO.XMLIOException
document
into a String
.doc
- the document compiled into a String
.doc
as a String
.XMLIO.XMLIOException
- is thrown if an XML operation fails.public Document read(String filename) throws XMLIO.XMLIOException
filename
.filename
- the input file name.Document
XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.public static Document readFromString(String input) throws XMLIO.XMLIOException
String
.input
- the string that contains the text of the XML documentDocument
XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.protected static Document read(InputStream input) throws XMLIO.XMLIOException
input
- the input streamDocument
XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.protected static Document read(Reader input) throws XMLIO.XMLIOException
Reader
.input
- the input Reader
Document
XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.protected static Document read(InputSource input) throws XMLIO.XMLIOException
input
- the input sourceDocument
XMLIO.XMLIOException
- is thrown if an XML operation fails or if an IO exception occurs.