XML Validation Service

Simple Validator

XML Validation WebService

This is an experimental XML Validation Service at http://qa-dev.w3.org:8888/xml-val-svc.so. To use it, POST your XML to this server, and it will be validated.

To use the service, your client software should send an HTTP request as shown, and accept a response in one of the formats supported by the service (XML, HTML or EARL).

Example Request


POST /xml-val-svc.so HTTP/1.0
Content-Type: text/xml
Content-Length: 12345
Content-Location: http://example.org/some/xml/doc.xml
X-Validator-Mode: valid,schema,namespace
X-Report-Format: earl

<?xml version="1.0"?>
 ... lots of XML here ...

HTTP Headers

The only HTTP headers of interest to the service are those shown. The first two are self-explanatory. The others (which are optional) are as follows:

Content-Location
This tells the validator where your document is located. It is only used in the report: the validator doesn't attempt to check the location at all.
X-Validator-Mode
This controls validation options, and can contain any combination of the tokens shown above. valid forces validation where the service would otherwise merely check for well-formedness; schema enables XML Schema support, and namespace enables XML Namespace processing.
X-Report-Format
The format of the report the service will return to you. Options are xml (the default), html and earl.

Note that the X-* headers are case-sensitive!

HTTP Request Body

The HTTP Request body posted is the XML to be validated. It must contain exactly one XML document, no more, no less.

The Response

The response is a brief report, delivered in your selected format (the XML option is the most efficient). In addition to the response body, the service sets two special-purpose HTTP headers:

X-Valid
Pass or Fail. Did the document pass validation in the selected mode.
X-Errors
The total count of errors and warnings.

About this service

This service uses Xerces to validate XML. It is running under the Apache webserver using mod_xml.

It was originally developed for Site Valet, and has been updated to use Xerces 2.1 for this service by Nick Kew, who also wrote the original.

The source code should be available under W3C CVS, but as yet isn't. It can be downloaded here.