Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

elifesciences/schematron-validator

Repository files navigation

Schematron Validator

Schematron is an API to validate the conformance of XML documents. This implementation checks its against the eLife's standards for JATS XML.

Usage

Submit an XML file via a POST HTTP request:

<form id="upload-form" enctype="multipart/form-data"
      action="https://schematron.elifesciences.org/document-validator/final/file"
      method="post">
    <input type="file" name="document" id="document"/>
    <input type="submit" value="Submit"/>
</form>

A JSON document will be returned, listing errors or warnings in the form of diagnostics.

The steps needed are:

  1. Prepare XML document for validation (make sure there are 0 syntax errors in the document – some XML tooling is more lenient with regards to XML parsing, we're using Saxon, which should be fine in most cases)
  2. Decide which document validation stage to run against (pre-edit or final).
  3. Send a POST (multipart-form) request to https://schematron.elifesciences.org/document-validator/$type/file with a document field containing the file, and $type being the validation stage pre-edit or final.
  4. Parse returned JSON in the format of:
{
  "status": "INVALID",
  "diagnostics": [
    {
      "context": "/article[1]/back[1]/ref-list[1]/ref[4]/element-citation[1]/year[1]",
      "message": "[err-elem-cit-gen-date-1-7]\n      If the <year> element contains any letter other than 'a' after the digits, there must be another \n      reference with the same first author surname (or collab) with the preceding letter after the year. \n      Reference '' does not fulfill this requirement.",
      "level": "ERROR"
    }
  ]
}

where the status can be INVALID, VALID, or VALID_WITH_WARNINGS.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published