java.lang.Object
bayern.steinbrecher.javaUtility.XMLUtility

public final class XMLUtility
extends java.lang.Object
Contains convenient method for handling and checking XML files.
Since:
0.1
  • Method Summary

    Modifier and Type Method Description
    static java.util.Optional<java.lang.String> isValidXML​(java.lang.String xml, java.net.URL schema)
    Checks whether the given String contains valid XML based on the given schemas.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isValidXML

      public static java.util.Optional<java.lang.String> isValidXML​(java.lang.String xml, java.net.URL schema) throws org.xml.sax.SAXException, java.io.IOException
      Checks whether the given String contains valid XML based on the given schemas.
      Parameters:
      xml - The XML content to check.
      schema - The XSD schema to validate against.
      Returns:
      An Optional containing the error output if XML is erroneous. If Optional.empty() is returned the XML does not contain errors but it may still contain warnings. If so these are logged.
      Throws:
      org.xml.sax.SAXException - If any parse error occurs.
      java.io.IOException - If any I/O error occurs.