Root - The type of object that is constructed by the parser.public final class XmlParser<Root> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlParser.Option
Options that can be passed to an XML parser.
|
| Modifier and Type | Method and Description |
|---|---|
Root |
parse(InputStream input,
XmlParser.Option... options)
Parse the XML document from the given input stream.
|
Root |
parse(Path input,
XmlParser.Option... options)
Parse the XML document at the given path.
|
Root |
parse(Reader input,
XmlParser.Option... options)
Parse the XML document from the given reader.
|
String |
toString() |
static <T> XmlParser<T> |
xmlParser(Class<T> root)
Create a new XML parser for the given type.
|
public static <T> XmlParser<T> xmlParser(Class<T> root)
T - the type of object constructed by the parser.root - the type of object that corresponds to the root element of the XML document the parser should parse.public Root parse(Path input, XmlParser.Option... options) throws ParserConfigurationException, SAXException, IOException
input - the path at which to find the XML document to parse.options - configuration for the XML parser.ParserConfigurationException - if an XML (SAX) parser cannot be created.SAXException - if parsing the XML document failed.IOException - if reading the XML document failed.public Root parse(Reader input, XmlParser.Option... options) throws ParserConfigurationException, SAXException, IOException
input - the reader to read the XML document from.options - configuration for the XML parser.ParserConfigurationException - if an XML (SAX) parser cannot be created.SAXException - if parsing the XML document failed.IOException - if reading the XML document failed.public Root parse(InputStream input, XmlParser.Option... options) throws ParserConfigurationException, SAXException, IOException
input - the stream to read the XML document from.options - configuration for the XML parser.ParserConfigurationException - if an XML (SAX) parser cannot be created.SAXException - if parsing the XML document failed.IOException - if reading the XML document failed.Copyright © 2019. All rights reserved.