Repository navigation
Releases
v1.16 (VS Code extension 0.5.12)
Faster again on large documents. Each Schematron rule is now evaluated in one Saxon call for all the elements it applies to, instead of one call per element. Saxon compiles every expression it is given, so the old way compiled a rule's expression once per element; on the smed <app> rule that compiling took 9 of its 9.6 seconds.
The single call returns, for each element, its path (for first-match shadowing) and the result of each test; only violations go back to Saxon to fill in their messages. If the single call fails (a test that raises an error, for instance), the rule is evaluated element by element as before, so shadowing and error reporting are unchanged.
On the smed Latin edition (about 26,000 lines), the check went from 11.5 s to 1.9 s, measured one after the other on the same machine. Results are identical on the 39 documents compared.
The first check after updating is slower once per schema: a new version of the script rebuilds its cached rules.
The VS Code extension 0.5.12 bundles py-xmlvalidate.py 1.16. The Emacs package uses the repository's copy, so straight-pull-package (or package-vc-upgrade) brings it in.
Files:
py-xmlvalidate-v.1.16.zip: the scripts, the Emacs package and the documentation.validate-schematron-0.5.12.vsix: the VS Code extension (install with Extensions: Install from VSIX…).
v1.15 (VS Code extension 0.5.11)
Faster checks. All the tests of a Schematron rule are now evaluated together, in one call per node, so the rule's <let> variables are computed once per node instead of once per test, as ISO Schematron intends. If the combined call fails, the rule's tests are evaluated one by one, so a broken test is still reported on its own.
On the smed Latin edition (about 26,000 lines, 2,054 <app> elements), a check went from 13.9 s to 3.5 s. Results are identical on the 35 documents compared.
The VS Code extension 0.5.11 bundles py-xmlvalidate.py 1.15; the speed-up matters most while you type in a large file.
Files:
py-xmlvalidate-v.1.15.zip: the scripts and documentation.validate-schematron-0.5.11.vsix: the VS Code extension (install with Extensions: Install from VSIX…).
v1.14
py-xmlvalidate.py 1.14
-
New:
py-xmlvalidate-install.py. It links the two scripts into~/bin, so you can run them by name from any folder:python3 py-xmlvalidate-install.py py-xmlvalidate.py document.xml py-xmlvalidate-all.sh document.xml
The links point to the project's folder, so a
git pullthere updates the commands at once. An existing file or another link with the same name is left alone;--forcereplaces another link, never a file.--uninstallremoves only its own links, and--bin FOLDERputs them somewhere else. -
Python check: the installer checks that the
python3the commands will use has saxonche and lxml. If it doesn't, the installer shows the command that installs them. -
Companion script:
py-xmlvalidate-all.shnow findspy-xmlvalidate.pythrough a symbolic link. -
Executable:
py-xmlvalidate.pyis now executable.
The validation itself is the same.
Files
py-xmlvalidate-v.1.14.zip: py-xmlvalidate.py, py-xmlvalidate-all.sh, py-xmlvalidate-install.py and their documentation.validate-schematron-0.5.10.vsix: the VS Code extension, unchanged since 0.5.10.
Both need Python 3.15 or later, with the saxonche and lxml libraries.
v1.13 (VS Code extension 0.5.10)
py-xmlvalidate.py 1.13
The scripts take the project's name: py-xmlvalidate.py (it was xmlvalidate.py) and py-xmlvalidate-all.sh (it was xmlvalidate-all.sh). Up to version 1.11 they were called validate.py and validate-all.sh. Nothing else changes in the validation. If you call the scripts from your own scripts or aliases, use the new names:
python3 py-xmlvalidate.py document.xml
./py-xmlvalidate-all.sh document.xmlVS Code extension 0.5.10
- It bundles
py-xmlvalidate.py1.13. Its name, ID (NicolasVaughan.validate-schematron) and title stay the same, so an installed copy updates as usual. - If you set
schematron.validatorPathto your own copy of the script, point it topy-xmlvalidate.py.
Files
validate-schematron-0.5.10.vsix: the VS Code extension.py-xmlvalidate-v.1.13.zip: py-xmlvalidate.py, py-xmlvalidate-all.sh and their documentation.
Both need Python 3.15 or later, with the saxonche and lxml libraries.
v1.12 (VS Code extension 0.5.8)
xmlvalidate.py 1.12
The script is renamed xmlvalidate.py (it was validate.py), and its companion xmlvalidate-all.sh (it was validate-all.sh), to match the project's new name, py-xmlvalidate. Nothing else changes in the validation. If you call the script from your own scripts or aliases, use the new names:
python3 xmlvalidate.py document.xml
./xmlvalidate-all.sh document.xmlVS Code extension 0.5.8
- It bundles
xmlvalidate.py1.12. Its title becomes Schematron Validator (xmlvalidate.py). - Its name and its ID,
NicolasVaughan.validate-schematron, stay the same, so an installed copy updates as usual. - If you set
schematron.validatorPathto your own copy of the script, point it toxmlvalidate.py.
Files
validate-schematron-0.5.8.vsix: the VS Code extension.validate-schematron-v.1.12.zip: xmlvalidate.py, xmlvalidate-all.sh and their documentation.
Both need Python 3.15 or later, with the saxonche and lxml libraries.
VS Code extension 0.5.9
VS Code extension 0.5.9. It bundles xmlvalidate.py 1.12, unchanged apart from comments.
Changes
- One name for the project: py-xmlvalidate. Its main program is
xmlvalidate.py(calledvalidate.pyuntil 1.12), with the companion scriptxmlvalidate-all.sh. The READMEs, the descriptions and the extension now say so. - Extension title: Schematron Validator (py-xmlvalidate). Its name and its ID,
NicolasVaughan.validate-schematron, stay the same, so an installed copy updates as usual. - Release zip: it is now called
py-xmlvalidate-v.1.12.zip. - Spanish texts: caché is now masculine throughout (el caché).
Files
validate-schematron-0.5.9.vsix: the VS Code extension.py-xmlvalidate-v.1.12.zip: xmlvalidate.py, xmlvalidate-all.sh and their documentation.
Both need Python 3.15 or later, with the saxonche and lxml libraries.
VS Code extension 0.5.7
VS Code extension 0.5.7. It bundles validate.py 1.11, which is unchanged.
Changes
- The repositories are now called py-xmlvalidate: https://github.com/nivaca/py-xmlvalidate and https://codeberg.org/nivaca/py-xmlvalidate. The old addresses still redirect there.
- The extension's README, its Setup Guide button and command, and the repository in its details now point to the new name.
- The extension keeps its name and its ID,
NicolasVaughan.validate-schematron, so an installed copy updates as usual.
Files
validate-schematron-0.5.7.vsix: the VS Code extension.validate-schematron-v.1.11.zip: validate.py and its documentation.
Install
code --install-extension validate-schematron-0.5.7.vsixThe extension needs Python 3.15 or later, with the saxonche and lxml libraries; its README explains the steps under Before you start.
Emacs package 0.2.0
Two additions to the Emacs package. py-xmlvalidate.py is unchanged (1.16).
Flycheck. The package now registers a Flycheck checker as well as the Flymake backend. With py-xmlvalidate-frontend at its default, auto, it uses Flycheck when it is installed and Flymake otherwise. With Flycheck, the problems appear in Flycheck's usual display (C-c ! l, the fringe, flycheck-posframe), with the layer at the start of each message and the Schematron pattern as the error's id. The package applies the trusted-content rule itself, since Flycheck has none.
The schema for nxml. nxml-mode cannot read <?xml-model?>, so it worked with an empty schema and its completion offered nothing. After each check whose schema is RelaxNG, the package now converts the schema to the compact syntax with trang, keeps it in a cache, and gives it to nxml: C-RET then completes the elements and attributes the schema allows, and nxml's own validation knows the schema. A schema you chose for nxml yourself is never replaced, and nothing is written next to your documents. nxml mishandles some Unicode punctuation (it would reject ed="#U2"), so in its copy of the schema TEI's word pattern also lists those characters.
trang needs Java. tools/install-trang.py, in the repository, downloads it from the jing-trang releases, checks its SHA-1 and installs it in ~/bin (or ~/.local/bin). Or set py-xmlvalidate-trang to another copy.
With Straight: M-x straight-pull-package RET py-xmlvalidate, then restart Emacs. M-x py-xmlvalidate-check-setup says which checker is used and whether trang is found.
File: py-xmlvalidate-emacs-v0.2.0.zip, the scripts, the Emacs package and the documentation.
Emacs package 0.1.2
A file that is not trusted is now hard to miss, and can be trusted on request. py-xmlvalidate.py is unchanged (1.15).
Flymake checks only the files in trusted-content, and this package keeps that rule: the schema a document names is run by Saxon, whose XPath can read files and fetch URLs. Until now the package said so only in a passing message, so a document opened from, say, ~/Downloads was never checked as you typed, and only py-xmlvalidate-report showed its Schematron errors.
- Opening an untrusted file shows a warning in the
*Warnings*buffer, once per file, with the line to add to your init file. M-x py-xmlvalidate-trust-fileasks whether to trust the file alone or its folder, adds it totrusted-contentfor the session, starts checking, and puts the line that keeps it in the kill ring.py-xmlvalidate-checkandpy-xmlvalidate-refresh-schemaexplain why they cannot run on an untrusted file, andpy-xmlvalidate-reportends with the same note.
Trust single files rather than folders like ~/Downloads/, where files from elsewhere arrive.
With Straight, M-x straight-pull-package RET py-xmlvalidate, then restart Emacs (or reload the package).
File: py-xmlvalidate-emacs-v0.1.2.zip, the scripts, the Emacs package and the documentation.
Emacs package 0.1.1
The Emacs package now installs with Straight. py-xmlvalidate.py is unchanged (1.15).
Straight builds a package from links to the files of its clone, so 0.1.0 could not find py-xmlvalidate.py, which it looked for in the folder above its own file. The package now also follows the link to its own file back to the clone.
With Straight and use-package:
(use-package py-xmlvalidate
:straight (:host codeberg :repo "nivaca/py-xmlvalidate"
:files ("emacs/*.el"))
:hook (nxml-mode . py-xmlvalidate-mode)):files is needed because the Lisp file is in emacs/. As before, add your documents' folders to trusted-content. emacs/README.md now covers package-vc, Straight and a plain clone.
File: py-xmlvalidate-emacs-v0.1.1.zip, the scripts, the Emacs package and the documentation.