Repository navigation
Releases
v1.8 (VS Code extension 0.4.0)
VS Code extension 0.4.0: validate as you type
The extension now validates the editor's current text, unsaved changes included, once typing pauses. Each keystroke restarts the wait, and an outdated run still in progress is cancelled, so fast typing produces a single validation.
| Setting | Default | What it does |
|---|---|---|
schematron.changeDelayMs |
500 |
How long typing must pause before validating, in ms (minimum 100). Changes apply immediately. |
schematron.validateOnChange |
true |
Turns validation while typing on or off. Validation on open and on save still works either way. |
- Your files stay untouched. Unsaved text is written to a private temporary folder, never next to your file, and deleted after each run.
- Half-typed tags show a "not well-formed" error on their line until the XML is complete again. jing is skipped in that state, so the same error isn't reported twice.
- Validate Current File now includes unsaved changes.
- Limitation: unsaved text is always validated as UTF-8.
validate.py 1.8
--as PATHvalidates a single document as if it were located at PATH. Relativexml-modelhrefs resolve from there, and the report uses that file name.- Schema auto-detection reads the
<?xml-model?>instructions tolerantly. A document that isn't (yet) well-formed now gets a normal "not well-formed" error with its line, instead of failing with an environment error.
Install the extension
code --install-extension validate-schematron-0.4.0.vsixv1.7 (VS Code extension 0.3.1)
validate.py 1.7: fixes schema-cache failures under concurrent runs
When several validations ran at once (e.g. VS Code validating multiple open files after a reload), one run could read a downloaded schema while another was still writing it, and fail with:
El esquema …-smtrad-schema.rng no es XML bien formado: Premature end of data …
The truncated copy then stayed in the cache, so every later run failed too, until --refresh.
- Atomic cache writes. Downloaded schemas and the harvested and extracted
.schfiles are written to a temporary file and renamed into place only when complete. Other runs see either nothing or the whole file, and an interrupted write leaves nothing behind. - Damaged copies are replaced. A damaged cached copy left by an older version is detected and re-downloaded or regenerated.
- Bad downloads are never cached. A download that isn't well-formed XML is reported and not stored.
- Harvest self-check before writing. The harvest self-check now runs on the serialized bytes before anything is written.
Stress test (one process re-downloading with --refresh for 20 s while three others validate): the old code failed 88 of 635 reads; 1.7 failed 0 of 513.
VS Code extension 0.3.1
This release only bundles validate.py 1.7; the extension's behaviour is unchanged.
code --install-extension validate-schematron-0.3.1.vsixv1.6 (VS Code extension 0.3.0)
validate.py 1.6: message fixes
<sch:name/>is now interpolated, including the optional@path. It used to be dropped, giving messages like "Error: has corresp…" with no element name.<sch:value-of>yields the string value. On an attribute it used to print the whole attribute:corresp=" corresp="#" ".- Message spacing is preserved around interpolated values, so
corresp="#"no longer becomescorresp=" # ". - In the terminal's aggregate count, the dynamic parts of a message show as
….
| Before | Now |
|---|---|
Error: element has corresp="#"… |
Error: div element has corresp="#"… |
Error: has corresp=" corresp="#" "… |
Error: div has corresp="#"… |
VS Code extension 0.3.0: status bar
For the active file, the status bar shows a spinner while validating, ✓ Schematron when the file is clean, Schematron: N when there are problems, and Schematron: failed (red) when validation can't run. The tooltip gives details and the time of the last check; click it to open the output log.
Install the extension
code --install-extension validate-schematron-0.3.0.vsixv1.5
New
--jsonoutput forvalidate.py: lists every violation with pattern, context,assert/report,role, interpolated message, line andxml:id, plus XPath errors per rule and the schema source. A malformed document becomes anerrorentry instead of aborting the run.- VS Code extension (
vscode/, 0.1.0): validates XML/TEI files on open and save, showing Schematron violations, and jing's RelaxNG errors for.rngsources, as editor diagnostics and in the Problems panel.role="warning"/"info"set the severity. The.vsixbelow bundlesvalidate.py.
Install the extension
code --install-extension validate-schematron-0.1.0.vsixYou need Python with pip install saxonche lxml; set schematron.pythonPath if they're in a venv. jing is optional. On Linux, use a native (RPM/deb) VS Code rather than the Flatpak, which can't see your host Python or jing. See vscode/README.md for settings.
Other changes
- Validation is separated from text reporting; the terminal output is unchanged.
- Fixed a broken options table in README.md.
v1.4
Fixes
- Schema- and pattern-level
<let>s are now honoured. Previously only rule-level<let>s were read, so any test using a variable declared higher up failed to evaluate and was silently skipped, so a document could pass with exit code 0. (They are evaluated in the rule's context, not the document root.) - Line /
xml:idresolution in-vnow works for no-namespace and undeclared-namespace elements, and for offenders that are attributes or text nodes (previouslyl.?).
Changes
- XPath evaluation errors are reported once per rule with a node count, and the summary flags the verdict as INCOMPLETO. The exit code is unchanged.
- Let/
current()wrapping is precomputed when the schema loads. - Refactor: shared
cache_al_diaandhref_xml_modelhelpers;validate-all.shnow reuseshref_xml_modelinstead of its own xml-model parsing.
VS Code extension 0.5.5
VS Code extension 0.5.5. validate.py is unchanged at 1.8, and the extension bundles it.
Clear setup instructions
The extension needs Python 3 with two libraries, saxonche and lxml. VS Code doesn't install them. The README, which is also the extension's Marketplace page, now opens with Before you start:
- Check that Python is installed, or install it.
- Install the two libraries in a virtual environment, with copy-paste commands for Linux, macOS and Windows.
- Point the extension at that Python with Schematron: Select Python Interpreter….
- Check that it works, for example on the example in the release zip.
It also covers optional jing (for structural checks) and has a table of what to do when something goes wrong.
When the Python in use lacks the libraries, the notification now has a Setup Guide button that opens these steps. They're also available anytime through the new command Schematron: Setup Guide.
Files
validate-schematron-0.5.5.vsix: the VS Code extension.validate-schematron-v.1.8.zip: validate.py and its documentation.
Install
code --install-extension validate-schematron-0.5.5.vsixIf you installed a version older than 0.5.4, uninstall nivaca.validate-schematron first.
VS Code extension 0.5.4
VS Code extension 0.5.4. validate.py is unchanged at 1.8, and the extension bundles it.
Changes
- Publisher: the extension's publisher is now NicolasVaughan, its publisher on the Visual Studio Marketplace. The extension's ID becomes
NicolasVaughan.validate-schematron. - Links: they point to the repositories' new name, py-validate.
Upgrading from an earlier .vsix
VS Code sees the new ID as a different extension. Uninstall the old one first, or both will run and every error will be reported twice:
code --uninstall-extension nivaca.validate-schematron
code --install-extension validate-schematron-0.5.4.vsixYour schematron.* settings are kept. Then run Developer: Reload Window.
Files
validate-schematron-0.5.4.vsix: the VS Code extension.validate-schematron-v.1.8.zip: validate.py and its documentation.
VS Code extension 0.5.3
VS Code extension 0.5.3. validate.py is unchanged at 1.8, and the extension bundles it.
New
- Changelog: the extension now carries a changelog covering every version from 0.1.0. The Marketplace shows it as the extension's Changelog tab.
- Zip of validate.py: releases now also include
validate-schematron-v.1.8.zip. It holdsvalidate.py,validate-all.sh, the READMEs, the licence anddocs/(the descriptions, the screenshots and an example to try).tools/bundle-zip.pymakes it, together with the.vsix. - Automatic Marketplace publishing: the extension can now be published to the Visual Studio Marketplace from GitHub Actions with Trusted Publishing, which needs no stored token (
.github/workflows/publish-vscode.yml). - vsce 4.1.0: the extension is packaged with vsce 4.1.0. The package's contents are unchanged apart from the changelog.
Files
validate-schematron-0.5.3.vsix: the VS Code extension.validate-schematron-v.1.8.zip: validate.py and its documentation. Unzip it, then runpython3 validate.py document.xmlwith a Python that hassaxoncheandlxml.
Install the extension
code --install-extension validate-schematron-0.5.3.vsixThen run Developer: Reload Window.
VS Code extension 0.5.2
VS Code extension only; validate.py is unchanged at 1.8, and the .vsix bundles it. The extension behaves the same as 0.5.1.
Licence
The project is now free software under the GNU General Public License, version 3 or later (GPL-3.0-or-later). Earlier versions were released under the MIT licence; copies of those versions keep that licence.
Install
code --install-extension validate-schematron-0.5.2.vsixThen run Developer: Reload Window.
VS Code extension 0.5.1
VS Code extension only; validate.py is unchanged at 1.8, and the .vsix bundles it. Behaviour is the same as 0.5.0.
New
- Screenshot in the extension README: the README shown on the extension's page in VS Code now opens with a screenshot of the extension at work. It shows errors underlined, the message of one, the Problems panel with the layer that found each error, and the count in the status bar.
Also in this release (repository)
tools/screenshots.py: regenerates the README screenshots, out of sight and with a throwaway profile:- a real terminal session of
validate.pyandvalidate-all.sh; - a real VS Code running the extension, in dark and light themes.
- a real terminal session of
docs/example/: a self-contained example to try the tools on.edition.xmlis a short TEI text with deliberate mistakes;schema.rngis a small RelaxNG schema with embedded Schematron rules.- READMEs:
README.mdandREADME_es.mdhave a new Screenshots section.
Install
code --install-extension validate-schematron-0.5.1.vsixThen run Developer: Reload Window.