Class OmeValidator


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

      • OmeValidator

        public OmeValidator()
    • Method Detail

      • isValidFile

        public boolean isValidFile​(File file,
                                   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​(File file,
                                   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​(File file,
                                 StreamSource[] schemaStreamArray)
                          throws 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:
        Exception - Thrown if an error occurred.
      • validateFileToStdError

        public void validateFileToStdError​(File file,
                                           StreamSource[] schemaStreamArray)
                                    throws 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:
        Exception - Thrown if other (NON-VALIDATION) errors occurred.
      • parseFile

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

        public Document parseFile​(File file,
                                  File schema)
                           throws 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:
        Exception - Thrown if an error occurred.
      • parseFileWithStreamArray

        public Document parseFileWithStreamArray​(File file,
                                                 StreamSource[] schemaStreamArray)
                                          throws 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:
        Exception - Thrown if an error occurred.
      • parseFileWithStreamArrayToSdtErr

        public Document parseFileWithStreamArrayToSdtErr​(File file,
                                                         StreamSource[] schemaStreamArray)
                                                  throws 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:
        Exception - Thrown if other (NON-VALIDATION) errors occurred.