Class ModelValidator


  • public abstract class ModelValidator
    extends Object
    The abstract class ModelValidator will serve as parent for ML validators. This might also be a good way to parse documents.
    Author:
    Martin Scharm
    • Field Detail

      • error

        protected Exception error
        The error.
    • Constructor Detail

      • ModelValidator

        public ModelValidator()
    • Method Detail

      • validate

        public abstract boolean validate​(de.unirostock.sems.xmlutils.ds.TreeDocument d)
        Validate a document.
        Parameters:
        d - the document
        Returns:
        true, if document is a valid model
      • validate

        public abstract boolean validate​(File d)
        Validate a document represented as a file.
        Parameters:
        d - the file storing a document
        Returns:
        true, if submitted string is a valid model
      • validate

        public abstract boolean validate​(String d)
        Validate a document represented as a string.
        Parameters:
        d - the textual representation of a document
        Returns:
        true, if submitted string is a valid model
      • getDocument

        public abstract ModelDocument getDocument()
        Gets the parsed document if it was valid, of null otherwise. Since we need to create a document anyways, here you can get it for free ;-)
        Returns:
        the document
      • getError

        public Exception getError()
        Gets the error the was thrown in case of an invalid document.
        Returns:
        the error
      • validate

        public boolean validate​(URL url)
        Validate a document downladable from a web server.
        Parameters:
        url - the URL to the webserver
        Returns:
        true, if submitted string is a valid model