Class XmlFile


  • public final class XmlFile
    extends Object
    An XML attribute value that corresponds to an XML file that can be parsed.
    • Method Detail

      • 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, instead nothing is 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 nothing if 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.