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.
- Checks if XML is well-formed.
- Validates XML with associated RELAX NG schema (via
<?xml-model?>
) when you open or modify a file. - 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
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.
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".
For a better XML editing experience we recommend also installing the following extensions:
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.