Class XsdValidator

All Implemented Interfaces:
Validator<Source,String>

public class XsdValidator extends AbstractCachingXmlProcessor<Schema> implements Validator<Source,String>
Validation of XML documents based on a XML Schema. Before using this class consider using a validating Parser class.
Author:
Christian Ohr
  • Constructor Details

    • XsdValidator

      public XsdValidator()
    • XsdValidator

      public XsdValidator(ClassLoader classloader)
  • Method Details

    • getCache

      Specified by:
      getCache in class AbstractCachingXmlProcessor<Schema>
      Returns:
      static cache for the configured resource type. Note that the returned Map is not necessarily synchronized.
    • validate

      public void validate(Source message, String schema)
      Specified by:
      validate in interface Validator<Source,String>
      Parameters:
      message - message to be validated
      schema - profile to be validated against
    • doValidate

      protected List<ValidationException> doValidate(Source message, String schemaResource)
      Parameters:
      message - the message to be validated
      schemaResource - the XML schema to validate against
      Returns:
      an array of validation exceptions
    • createResource

      protected Schema createResource(Object... params)
      Description copied from class: AbstractCachingXmlProcessor
      Creates a ready-to-use resource (e.g. an XML Schema instance) for the given key. Insertion into the cache will happen externally, this method's purpose is only to instantiate the resource to be cached.

      This method does not need to be re-entrant, but its result MUST be thread-safe.

      Specified by:
      createResource in class AbstractCachingXmlProcessor<Schema>
      Parameters:
      params - validator/transmogrifier parameters.
      Returns:
      resource of the configured type.
    • getSchemaLanguage

      public String getSchemaLanguage()
    • setSchemaLanguage

      public void setSchemaLanguage(String schemaLanguage)