---
title: XML diff patches
summary: Change data with a targeted patch and verify that its selector matches the intended node.
section: scripting
kind: guide
status: example
updated: 2026-10-27
tags: ["X4","modding","xml","patches"]
sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/"]
---
## Find the original node first
Read the file from your game version. Record its path, stable element ID and original value, then create a patch at the corresponding extension path. `add`, `replace` and `remove` solve different tasks. Replacing a whole document for one attribute increases update sensitivity and conflicts.
## Learning example
The invented document below is not a game file. Its patch changes one enabled attribute from false to true. Do not copy the sample items path into a real mod without an actual matching target document.
```xml
```
```xml
true
```
## Verify the selector
Find matches, confirm the intended object and type, apply the patch and compare the effective document, then run the game and inspect the effect and log. Zero matches may mean a wrong version, path or unavailable dependency. Multiple matches may mean an overly broad selector. Silencing errors hides both problems.
## Next practical step
The [selector walkthrough](wiki:xpath-selectors) demonstrates add, replace and remove on one document with its complete expected result.
Read [the real Elite hull example](wiki:editing-parameters). If several mods change the same field, verify [compatibility](wiki:compatibility) and the effective document.