Module xml.base

Class ValidatorExtensions


  • public final class ValidatorExtensions
    extends java.lang.Object
    The class ValidatorExtensions can validate xml files
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void validateSchema​(java.io.File xsd, java.io.File xml, org.xml.sax.ErrorHandler errorHandler)
      Validate xml through xsd.
      static boolean validateSchema​(java.lang.String schemaUrl, java.lang.String xmlDocumentUrl)
      Validate given xml schema.
      • Methods inherited from class java.lang.Object

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

      • validateSchema

        public static void validateSchema​(java.io.File xsd,
                                          java.io.File xml,
                                          org.xml.sax.ErrorHandler errorHandler)
                                   throws org.xml.sax.SAXException,
                                          javax.xml.parsers.ParserConfigurationException,
                                          java.io.IOException
        Validate xml through xsd.
        Parameters:
        xsd - the xsd
        xml - the xml
        errorHandler - the error handler
        Throws:
        org.xml.sax.SAXException - If a SAX error occurs during parsing.
        javax.xml.parsers.ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
        java.io.IOException - Signals that an I/O exception has occurred.
      • validateSchema

        public static boolean validateSchema​(java.lang.String schemaUrl,
                                             java.lang.String xmlDocumentUrl)
                                      throws org.xml.sax.SAXException,
                                             javax.xml.parsers.ParserConfigurationException,
                                             java.io.IOException
        Validate given xml schema.
        Parameters:
        schemaUrl - the schema url
        xmlDocumentUrl - the xml document url
        Returns:
        true if the given xml is valid otherwise false
        Throws:
        org.xml.sax.SAXException - If a SAX error occurs during parsing.
        javax.xml.parsers.ParserConfigurationException - if a DocumentBuilder cannot be created which satisfies the configuration requested.
        java.io.IOException - Signals that an I/O exception has occurred.