Class XmlSchemaContentValidator

All Implemented Interfaces:
IResourceResolver, IContentValidator

public class XmlSchemaContentValidator extends AbstractContentValidator
Supports validating an XML resource using an XML schema.
  • Constructor Details

    • XmlSchemaContentValidator

      public XmlSchemaContentValidator(@Owning @NonNull @Owning List<? extends Source> schemaSources) throws IOException
      Construct a new XML schema validator using the provided XML schema sources.

      This constructor takes ownership of the provided schema sources and is responsible for closing any associated input streams.

      Parameters:
      schemaSources - the XML schemas to use for validation. Ownership of these sources is transferred to this constructor, which will close any associated input streams.
      Throws:
      IOException - if an error occurred while parsing the provided XML schemas
    • XmlSchemaContentValidator

      protected XmlSchemaContentValidator(@NonNull Schema schema)
      Construct a new XML schema validator using the provided pre-parsed XML schema(s).
      Parameters:
      schema - the pre-parsed XML schema(s) to use for validation
  • Method Details

    • validate

      public IValidationResult validate(InputStream is, URI documentUri) throws IOException
      Description copied from interface: IContentValidator
      Validate the resource associated with the provided input stream is.
      Parameters:
      is - an input stream to access the resource
      documentUri - the URI of the resource to validate
      Returns:
      the result of the validation
      Throws:
      IOException - if an error occurred while performing validation