Class Validator


  • public class Validator
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Validator​(java.lang.String schema)
      Constructor that creates a new Validator object
      Validator​(java.lang.String schema, org.xml.sax.EntityResolver resolver)
      Constructor that creates a new Validator object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.w3c.dom.Document parse​(java.io.InputStream xml)
      method which parses an xml document from an input stream, validates it and returns the subsequent Document object.
      org.w3c.dom.Document parse​(java.io.Reader xml)
      method which parses an xml document from a Reader, validates it and returns the subsequent Document object.
      org.w3c.dom.Document parse​(org.xml.sax.InputSource xml)
      method which parses an xml document from an input source, validates it and returns the subsequent Document object.
      • Methods inherited from class java.lang.Object

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

      • Validator

        public Validator​(java.lang.String schema)
                  throws java.lang.Exception
        Constructor that creates a new Validator object
        Parameters:
        schema - a valid url to the schema to process
        Throws:
        java.lang.Exception - if a parse error is encountered
      • Validator

        public Validator​(java.lang.String schema,
                         org.xml.sax.EntityResolver resolver)
                  throws java.lang.Exception
        Constructor that creates a new Validator object
        Parameters:
        schema - a valid url to the schema to process
        resolver - an EntityResolver to use to retrieve included / imported documents
        Throws:
        java.lang.Exception - if a parse error is encountered
    • Method Detail

      • parse

        public org.w3c.dom.Document parse​(java.io.InputStream xml)
                                   throws java.lang.Exception
        method which parses an xml document from an input stream, validates it and returns the subsequent Document object.
        Parameters:
        xml - the xml document as input stream
        Returns:
        the resultant Document (if parsing successful)
        Throws:
        java.lang.Exception - if the document fails to be validated
      • parse

        public org.w3c.dom.Document parse​(java.io.Reader xml)
                                   throws java.lang.Exception
        method which parses an xml document from a Reader, validates it and returns the subsequent Document object.
        Parameters:
        xml - the xml document as reader
        Returns:
        the resultant Document (if parsing successful)
        Throws:
        java.lang.Exception - if the document fails to be validated
      • parse

        public org.w3c.dom.Document parse​(org.xml.sax.InputSource xml)
                                   throws java.lang.Exception
        method which parses an xml document from an input source, validates it and returns the subsequent Document object.
        Parameters:
        xml - the xml document as input source
        Returns:
        the resultant Document (if parsing successful)
        Throws:
        java.lang.Exception - if the document fails to be validated