Package org.opencypher.tools.xml
Class XmlFile
- java.lang.Object
-
- org.opencypher.tools.xml.XmlFile
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tparse(XmlParser<T> parser)Parse this XML document with the given parser.<T> Optional<T>parseOnce(XmlParser<? extends T> parser)Parse this XML document with the given parser if it has not already been parsed.Stringpath()The path at which this document is located.
-
-
-
Method Detail
-
parse
public <T> T parse(XmlParser<T> parser) throws ParserConfigurationException, SAXException, IOException
Parse this XML document with the given parser.- Type Parameters:
T- the type of the element produced by parsing the XML document.- Parameters:
parser- the parser to parse the document with.- Returns:
- the object parsed from the XML document.
- Throws:
ParserConfigurationException- if an XML (SAX) parser cannot be created.SAXException- if parsing the XML document failed.IOException- if reading the XML document failed.
-
parseOnce
public <T> Optional<T> parseOnce(XmlParser<? extends T> parser) throws IOException, SAXException, ParserConfigurationException
Parse this XML document with the given parser if it has not already been parsed. If this XML document has not been parsed already, it is parsed and the result returned. If it has been parsed it is not parsed again, insteadnothingis returned.- Type Parameters:
T- the type of the element produced by parsing the XML document.- Parameters:
parser- the parser to parse the document with.- Returns:
- the object parsed from the XML document, or
nothingif the document has been parsed before. - Throws:
ParserConfigurationException- if an XML (SAX) parser cannot be created.SAXException- if parsing the XML document failed.IOException- if reading the XML document failed.
-
path
public String path()
The path at which this document is located.- Returns:
- the path at which this document is located.
-
-