Class OmeValidator


  • public class OmeValidator
    extends java.lang.Object
    Provides methods to validate OME instance documents against
    Since:
    Beta4.4
    • Constructor Summary

      Constructors 
      Constructor Description
      OmeValidator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isValidFile​(java.io.File file, java.io.File schema)
      Validate the specified file
      boolean isValidFile​(java.io.File file, javax.xml.transform.stream.StreamSource[] schemaStreamArray)
      Validate the specified file
      org.w3c.dom.Document parseFile​(java.io.File file)
      Parses the specified file and returns the document.
      org.w3c.dom.Document parseFile​(java.io.File file, java.io.File schema)
      Parses the specified file and returns the document.
      org.w3c.dom.Document parseFileWithStreamArray​(java.io.File file, javax.xml.transform.stream.StreamSource[] schemaStreamArray)
      Parses the specified file and returns the document.
      org.w3c.dom.Document parseFileWithStreamArrayToSdtErr​(java.io.File file, javax.xml.transform.stream.StreamSource[] schemaStreamArray)
      Parses the specified file and returns the document.
      void validateFile​(java.io.File file, java.io.File schema)  
      void validateFile​(java.io.File file, javax.xml.transform.stream.StreamSource[] schemaStreamArray)
      Validate the specified file Any validation errors thrown as an exception.
      void validateFileToStdError​(java.io.File file, javax.xml.transform.stream.StreamSource[] schemaStreamArray)
      Validate the specified file Any validation errors are sent to StdErr, not thrown as an exception.
      • Methods inherited from class java.lang.Object

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

      • JAXP_SCHEMA_LANGUAGE

        public static final java.lang.String JAXP_SCHEMA_LANGUAGE
        Path the schema language.
        See Also:
        Constant Field Values
      • W3C_XML_SCHEMA

        public static final java.lang.String W3C_XML_SCHEMA
        W3C.
        See Also:
        Constant Field Values
      • JAXP_SCHEMA_SOURCE

        public static final java.lang.String JAXP_SCHEMA_SOURCE
        The source.
        See Also:
        Constant Field Values
    • Constructor Detail

      • OmeValidator

        public OmeValidator()
    • Method Detail

      • isValidFile

        public boolean isValidFile​(java.io.File file,
                                   java.io.File schema)
        Validate the specified file
        Parameters:
        file - The file to parse.
        schema - The schema used to validate the specified file.
        Returns:
        true if no errors
      • isValidFile

        public boolean isValidFile​(java.io.File file,
                                   javax.xml.transform.stream.StreamSource[] schemaStreamArray)
        Validate the specified file
        Parameters:
        file - The file to parse.
        schemaStreamArray - The schema as array of stream sources used to validate the specified file.
        Returns:
        true if no errors
      • validateFile

        public void validateFile​(java.io.File file,
                                 javax.xml.transform.stream.StreamSource[] schemaStreamArray)
                          throws java.lang.Exception
        Validate the specified file Any validation errors thrown as an exception.
        Parameters:
        file - The file to parse.
        schemaStreamArray - The schema as array of stream sources used to validate the specified file.
        Throws:
        java.lang.Exception - Thrown if an error occurred.
      • validateFile

        public void validateFile​(java.io.File file,
                                 java.io.File schema)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • validateFileToStdError

        public void validateFileToStdError​(java.io.File file,
                                           javax.xml.transform.stream.StreamSource[] schemaStreamArray)
                                    throws java.lang.Exception
        Validate the specified file Any validation errors are sent to StdErr, not thrown as an exception.
        Parameters:
        file - The file to parse.
        schemaStreamArray - The schema as array of stream sources used to validate the specified file.
        Throws:
        java.lang.Exception - Thrown if other (NON-VALIDATION) errors occurred.
      • parseFile

        public org.w3c.dom.Document parseFile​(java.io.File file)
                                       throws java.lang.Exception
        Parses the specified file and returns the document.
        Parameters:
        file - The file to parse.
        Returns:
        Document
        Throws:
        java.lang.Exception - Thrown if an error occurred.
      • parseFile

        public org.w3c.dom.Document parseFile​(java.io.File file,
                                              java.io.File schema)
                                       throws java.lang.Exception
        Parses the specified file and returns the document.
        Parameters:
        file - The file to parse.
        schema - The schema used to validate the specified file.
        Returns:
        Document
        Throws:
        java.lang.Exception - Thrown if an error occurred.
      • parseFileWithStreamArray

        public org.w3c.dom.Document parseFileWithStreamArray​(java.io.File file,
                                                             javax.xml.transform.stream.StreamSource[] schemaStreamArray)
                                                      throws java.lang.Exception
        Parses the specified file and returns the document. Any validation errors are thrown as an exception.
        Parameters:
        file - The file to parse.
        schemaStreamArray - The schema as array of stream sources used to validate the specified file.
        Returns:
        Document
        Throws:
        java.lang.Exception - Thrown if an error occurred.
      • parseFileWithStreamArrayToSdtErr

        public org.w3c.dom.Document parseFileWithStreamArrayToSdtErr​(java.io.File file,
                                                                     javax.xml.transform.stream.StreamSource[] schemaStreamArray)
                                                              throws java.lang.Exception
        Parses the specified file and returns the document. Any validation errors are sent to StdErr, not thrown as an exception.
        Parameters:
        file - The file to parse.
        schemaStreamArray - The schema as array of stream sources used to validate the specified file.
        Returns:
        Document
        Throws:
        java.lang.Exception - Thrown if other (NON-VALIDATION) errors occurred.