Class XsdValidation


  • public class XsdValidation
    extends java.lang.Object
    Methods to perform validation against XSD schemas. This is intended for use where the schemas are known by the IvoaSchemaResolver.
    Since:
    24 Sep 2018
    Author:
    Mark Taylor
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  XsdValidation.Result
      Enumerates possible results of the parse.
    • Constructor Summary

      Constructors 
      Constructor Description
      XsdValidation()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)
      Main method.
      static XsdValidation.Result validateDoc​(Reporter reporter, java.net.URL docUrl, java.lang.String topElName, java.lang.String topElNamespaceUri, boolean includeSummary)
      Validates a given document XML document against its declared schema.
      • Methods inherited from class java.lang.Object

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

      • XsdValidation

        public XsdValidation()
    • Method Detail

      • validateDoc

        public static XsdValidation.Result validateDoc​(Reporter reporter,
                                                       java.net.URL docUrl,
                                                       java.lang.String topElName,
                                                       java.lang.String topElNamespaceUri,
                                                       boolean includeSummary)
        Validates a given document XML document against its declared schema. If an expected top element name is supplied, a check is also made that the top element of the validated document matches it.

        Getting this right seems to be remarkably painful. See comments in the implementation for details.

        Parameters:
        reporter - destination for validation messages
        docUrl - URL of XML document to validate
        topElName - expected name for top element; may be null
        topElNamespaceUri - expected namespace for top element; only used for reporting messages, and ignored if topElName is null
        includeSummary - if true, report an end-of-stage type summary
        Returns:
        validation result
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Main method. Usage: <url-to-validate> [<expected-top-level-element>].
        Throws:
        java.io.IOException