
Description
Use when authoring XML documents as MPS root nodes or building XML-generating generator templates with jetbrains.mps.core.xml — covers XmlFile, XmlDocument, prolog (XML declaration, DOCTYPE, processing instructions, comments), elements, attributes, CDATA, entity references, and macro attachment via the smodelAttribute role for templates that emit XML output.
SKILL.md
jetbrains.mps.core.xml Language
jetbrains.mps.core.xml is an MPS language for authoring and generating XML documents inside MPS models. It is used either for direct XML authoring (an XmlFile root holds a complete document) or for generator templates (an XmlFile carries RootTemplateAnnotation and macros via smodelAttribute child roles).
Language reference: l:479c7a8c-02f9-43b5-9139-d910cb22f298:jetbrains.mps.core.xml
Critical Directives
- Wrap everything in
XmlFile → XmlDocument.XmlFileis the only rootable concept.XmlDocument.rootElementhas cardinality 1 — put the root there, not incontent. XmlPrologis optional (0..1). Omit it entirely when no prolog is needed.- Attribute values are lists of
XmlValuePart. A plain string is a singleXmlTextValue. An attribute with novaluechildren renders as a valueless (boolean) attribute. - Property name asymmetry:
XmlText/XmlSingleLineTextuse the propertyvalue.XmlTextValue(attribute value part) uses the propertytext. Do not swap them. - In generators, macros go in the
smodelAttributechild role of the node they annotate — not as siblings incontentorattributes. - Subclass the base types. Extend
XmlBaseAttribute(notXmlAttribute) andXmlBaseElement(notXmlElement) when defining custom concepts for derived languages. - Do not hand-edit serialized
.mpsfiles. Use MPS MCP node tools for all changes.
Common-Path Workflow
- Add
jetbrains.mps.core.xmlas a used language on the target model. For generator templates, also addjetbrains.mps.lang.generator. - Create an
XmlFileroot node with aname. Thenameis the template/document identifier, not the output filename. - Add an
XmlDocumentchild in roledocument. Optionally add anXmlPrologfor declarations/comments/PIs. - Build the document tree under
XmlDocument.rootElementand the innercontentlists. - For generator templates, attach
RootTemplateAnnotationto theXmlFileviasmodelAttribute, and attach macros (PropertyMacro,LoopMacro,CopySrcNodeMacro, …) to inner nodes via theirsmodelAttributerole. - Validate with
mps_mcp_check_root_node_problems.
Related Skills
mps-aspect-generator— for generator-side macro design that produces these XML templates.mps-aspect-textgen— for the text-serialization layer that turns these XML trees into output files.mps-node-editing— generic JSON-blueprint node creation/replacement workflow.
Reference Index
- Concept catalog — open when you need exact concept names, properties, cardinalities, or aliases for any document, prolog, element, attribute, or content node. See references/concept-catalog.md.
- JSON blueprint patterns — open when constructing or editing concrete XML trees as JSON for
mps_mcp_insert_root_node_from_json,mps_mcp_update_node. Includes minimal files, prolog with declarations, DOCTYPE, comments, attributes, mixed values, CDATA, processing instructions, and a full generator-template example. See references/json-blueprints.md. - Rules and pitfalls — open when a node validates but the rendered XML is wrong, when attribute/value naming feels inconsistent, or before subclassing element/attribute concepts. See references/rules-and-pitfalls.md.
- Language dependencies — open when setting up a new model that uses XML concepts, or when wiring generator templates that mix XML with generator macros. See references/language-dependencies.md.
More skills from the MPS repository
View all 31 skillsmps-aspect-accessories
configure JetBrains MPS module dependencies
Jul 17ArchitectureConfigurationEngineeringmps-aspect-actions
define and edit MPS node factories
Jul 17ArchitectureEngineeringmps-aspect-behavior
define and edit MPS concept behavior
Jul 13ArchitectureEngineeringmps-aspect-constraints
define JetBrains MPS language constraints
Jul 23ArchitectureCode Analysismps-aspect-dataflow
define and debug MPS dataflow builders
Jul 13Data Analysismps-aspect-editor
define MPS editor layouts
Jul 23DesignUI Components
More from JetBrains
View publishermps-aspect-editor-menus-and-keymaps
author MPS editor menus and keymaps
MPS
Jul 23EngineeringUI Componentsmps-aspect-generation-plan
modify MPS generation plans
MPS
Jul 13ArchitectureEngineeringmps-aspect-generator
define JetBrains MPS generator rules
MPS
Jul 17ArchitectureCode AnalysisEngineeringmps-aspect-intentions
define and edit MPS intentions
MPS
Jul 23ArchitectureEngineeringmps-aspect-migrations
author and debug MPS migration scripts
MPS
Jul 13DebuggingMigrationmps-aspect-structure-concepts
define concepts in MPS structure aspect
MPS
Jul 23Data Modeling