# Class XsdValidation

java.lang.Object
uk.ac.starlink.ttools.taplint.XsdValidation

public class XsdValidation extends 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 enum`
`XsdValidation.Result`
Enumerates possible results of the parse.

## Constructor Summary

Constructors
Constructor
Description
`XsdValidation()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`main(String[] args)`
Main method.
`static XsdValidation.Result`
`validateDoc(Reporter reporter, URL docUrl, String topElName, String topElNamespaceUri, boolean includeSummary)`
Validates a given document XML document against its declared schema.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### XsdValidation

public XsdValidation()

## Method Details

### validateDoc

public static XsdValidation.Result validateDoc(Reporter reporter, URL docUrl, String topElName, 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(String[] args) throws IOException
Main method. Usage: <url-to-validate> [<expected-top-level-element>].

Throws:
  `IOException`