Class ValidationXsdUtils


  • public class ValidationXsdUtils
    extends java.lang.Object
    Class ValidationXsdUtils validate the file XML by XSD Method checkWithXSD return true if XSD validate the file XML, else return false
    • Field Detail

      • RNG_PROPERTY_KEY

        public static final java.lang.String RNG_PROPERTY_KEY
        See Also:
        Constant Field Values
      • HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1

        public static final java.lang.String HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1
        See Also:
        Constant Field Values
      • CATALOG_FILENAME

        public static final java.lang.String CATALOG_FILENAME
        Filename of the catalog file ; should be found in the classpath.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ValidationXsdUtils

        public ValidationXsdUtils()
    • Method Detail

      • checkWithXSD

        public boolean checkWithXSD​(java.io.InputStream xmlFile,
                                    java.lang.String xsdFile)
                             throws org.xml.sax.SAXException,
                                    java.io.IOException,
                                    javax.xml.stream.XMLStreamException
        Parameters:
        xmlFile - the file to validate
        xsdFile - the xsd schema to validate with the file
        Returns:
        true(if XSD validate the file XML)
        Throws:
        java.io.FileNotFoundException - if the file is not found
        javax.xml.stream.XMLStreamException - if it couldnt create an xml stream reader
        org.xml.sax.SAXException - if the file is not valid with the XSD, or the file is not an xml file
        java.io.IOException - if the schema file could not be found
      • checkFileXSD

        public boolean checkFileXSD​(java.io.InputStream xmlFile,
                                    java.io.File xsdFile)
                             throws org.xml.sax.SAXException,
                                    java.io.IOException,
                                    javax.xml.stream.XMLStreamException
        Parameters:
        xmlFile -
        xsdFile -
        Returns:
        true if validated
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • checkFileRNG

        public boolean checkFileRNG​(java.io.InputStream xmlFile,
                                    java.io.File xsdFile)
                             throws org.xml.sax.SAXException,
                                    java.io.IOException
        Parameters:
        xmlFile -
        xsdFile -
        Returns:
        true if validated
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getSchema

        public static javax.xml.validation.Schema getSchema​(java.io.File file)
                                                     throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException