Scholarly XML is a VSCode extension with a RELAX NG validator and autocomplete with features typically needed by academic encoding projects.
Unlike most XML VSCode extensions, Scholarly XML does not require Java. The extension builds on a fork of Salve, a TypeScript RELAX NG implementation. This makes Scholarly XML easy to install for use with students, in workshops, and in minimal computing projects.
In 2024, this extension was awarded the Rahtz Prize for TEI Ingenuity.
- Checks if XML is well-formed.
- Validates XML with associated RELAX NG schema (via
<?xml-model?>) when you open or modify a file. - Validates XML with associated Schematron (via
<?xml-model?>) when you open or modify a file (configurable). - Makes schema aware suggestions for elements, attributes, and attribute values.
- When available, shows documentation from schema for elements, attributes, and attribute values.
- Wrap selected text with tags using Ctrl+e
- Partial XInclude support (configurable): only
<xi:include href="URL_TO_XML">is supported. More support is scheduled for future releases.
To validate, your XML file needs to be associated to a RELAX NG schema via <?xml-model?>. For example:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model
href="https://vault.tei-c.org/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng"
schematypens="http://relaxng.org/ns/structure/1.0"
type="application/xml"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" />Validation will trigger automatically when you open an XML file and when you make changes. Or you can trigger it manually like this:
- Bring up the Command Palette (F1, or Ctrl+Shift+P on Windows and Linux, or Shift+CMD+P on OSX)
- Type or select "Scholarly XML: Validate XML with associated RELAX NG schema."
Validation continues as you type and the result is shown in the status bar at the bottom.
A Schematron file needs to be associated via <?xml-model?>.
It can be embedded in RNG:
<?xml-model
href="tei_all.rng"
schematypens="http://purl.oclc.org/dsdl/schematron"
type="application/xml"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" />or it can be standalone:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model
href="schtest.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"
type="application/xml"
?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" />Schema-aware suggestions will be made as you type elements, attributes, and attribute values. You can also bring them up like all other suggestions using Ctrl+Space.
If it's available in the schema, documentation will be shown.
Select some text and wrap it in a tag using Ctrl+e or by bringing up the Command Palette and typing "Scholarly XML: Wrap selection with element".
You can read the change log here.
Like this extension? Star it on GitHub!
Do you have an idea or suggestion? Open a feature request.
Found something wrong? File an issue.



