Class XMLSchemaValidationHelper


  • @Immutable
    public final class XMLSchemaValidationHelper
    extends Object
    A helper class for simple XSD validation.
    Author:
    Philip Helger
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.helger.commons.error.list.IErrorList validate​(com.helger.commons.io.resource.IReadableResource[] aSchemas, com.helger.commons.io.resource.IReadableResource aXML)  
      static com.helger.commons.error.list.IErrorList validate​(com.helger.commons.io.resource.IReadableResource[] aSchemas, Source aXML)  
      static com.helger.commons.error.list.IErrorList validate​(com.helger.commons.io.resource.IReadableResource aSchema, com.helger.commons.io.resource.IReadableResource aXML)  
      static com.helger.commons.error.list.IErrorList validate​(com.helger.commons.io.resource.IReadableResource aSchema, Source aXML)  
      static com.helger.commons.error.list.IErrorList validate​(Schema aSchema, com.helger.commons.io.resource.IReadableResource aXML)  
      static com.helger.commons.error.list.IErrorList validate​(Schema aSchema, Source aXML)  
      static void validate​(Schema aSchema, Source aXML, com.helger.commons.error.list.ErrorList aErrorList)
      Validate the passed XML against the passed XSD and put all errors in the passed error list.
      static void validate​(Schema aSchema, Source aXML, com.helger.commons.error.list.ErrorList aErrorList, Locale aLocale)
      Validate the passed XML against the passed XSD and put all errors in the passed error list.
    • Method Detail

      • validate

        @Nonnull
        public static com.helger.commons.error.list.IErrorList validate​(@Nonnull
                                                                        com.helger.commons.io.resource.IReadableResource aSchema,
                                                                        @Nonnull
                                                                        com.helger.commons.io.resource.IReadableResource aXML)
      • validate

        @Nonnull
        public static com.helger.commons.error.list.IErrorList validate​(@Nonnull @Nonempty
                                                                        com.helger.commons.io.resource.IReadableResource[] aSchemas,
                                                                        @Nonnull
                                                                        com.helger.commons.io.resource.IReadableResource aXML)
      • validate

        @Nonnull
        public static com.helger.commons.error.list.IErrorList validate​(@Nonnull
                                                                        Schema aSchema,
                                                                        @Nonnull
                                                                        com.helger.commons.io.resource.IReadableResource aXML)
      • validate

        @Nonnull
        public static com.helger.commons.error.list.IErrorList validate​(@Nonnull @Nonempty
                                                                        com.helger.commons.io.resource.IReadableResource aSchema,
                                                                        @Nonnull
                                                                        Source aXML)
      • validate

        @Nonnull
        public static com.helger.commons.error.list.IErrorList validate​(@Nonnull @Nonempty
                                                                        com.helger.commons.io.resource.IReadableResource[] aSchemas,
                                                                        @Nonnull
                                                                        Source aXML)
      • validate

        public static void validate​(@Nonnull
                                    Schema aSchema,
                                    @Nonnull
                                    Source aXML,
                                    @Nonnull
                                    com.helger.commons.error.list.ErrorList aErrorList)
        Validate the passed XML against the passed XSD and put all errors in the passed error list.
        Parameters:
        aSchema - The source XSD. May not be null.
        aXML - The XML to be validated. May not be null.
        aErrorList - The error list to be filled. May not be null.
        Throws:
        IllegalArgumentException - If XSD validation failed with an exception
        Since:
        8.5.3
      • validate

        public static void validate​(@Nonnull
                                    Schema aSchema,
                                    @Nonnull
                                    Source aXML,
                                    @Nonnull
                                    com.helger.commons.error.list.ErrorList aErrorList,
                                    @Nullable
                                    Locale aLocale)
        Validate the passed XML against the passed XSD and put all errors in the passed error list.
        Parameters:
        aSchema - The source XSD. May not be null.
        aXML - The XML to be validated. May not be null.
        aErrorList - The error list to be filled. May not be null.
        aLocale - The locale to use for error messages. May be null to use the system default locale.
        Throws:
        IllegalArgumentException - If XSD validation failed with an exception
        Since:
        9.0.1