MPS 2024.1 Help

XML language

The jetbrains.mps.core.xml language is designed to model closely XML documents in MPS. The language aims at being a 1:1 match to plain XML and is generated into textual XML files.

Structure

The XmlFile root element should be used to represent an XML file.

xml1.png

It contains a single XmlDocument node, which itself holds one or more prolog entries and a root xml element:

xml2.png

There are several types of prolog elements to choose from and customize:

xml3.png

Use the Enter key to separate entries in the prolog, either within the same line or across multiple lines.

Editing

The elements, their attributes and values can then be entered naturally. The XML-specific symbols, such as e.g. '<', '>', '=', 'space', "&", are recognized as delimiters and the automatically invoked transformations will correctly insert proper instances of the desired concepts - XmlElement, XmlAttribute, XmlTextXmlTextValue, XmlEntityRef, XmlEntityRefValue, XmlComment and other. Code-completion should assist you to complete unfinished elements with little effort.

xml4.png

Generation

The language is transformed into textual XML using the TextGen aspect.

xml5.png
Last modified: 11 February 2024