--- title: XML editor and X4 schema setup summary: Attribute completion, XSD validation and the difference between a final document and a diff patch. section: tools kind: guide status: reference updated: 2026-10-27 tags: ["X4","modding","tool","xml","editor"] sources: ["https://github.com/redhat-developer/vscode-xml","https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/"] --- ## Purpose and preparation Use an editor supporting XML Schema, such as VS Code with Red Hat XML. Extract the libraries/*.xsd set for your game version using [X Catalog Tool](wiki:tool-catalog); schemas reference one another, so md.xsd alone may be insufficient. ## First exercise 1. Open a separate workspace and enable XML support. 2. Keep schemas in reference/libraries with their relative relationships intact. 3. Associate MD documents with md.xsd through xml.fileAssociations or a document schema reference. Use your installation's aiscripts.xsd for AI. 4. Inspect Problems and attribute completion. Temporarily add an unknown attribute, confirm a diagnostic, then remove it. ```xml ``` ## Expected result The editor can complete set_value attributes from its schema. In a prepared MD context this fragment assigns 5 to $Count; the editor does not execute it or print a log message. ## Checks and limits Do not associate every XML file with md.xsd: macros, diffs and MD documents have different roots. Schema validation does not establish object existence or successful XPath application. [Schema types](wiki:schema-types) explain expression, object and constraints.