From bab28f681c14d3c0bde9d0cf019290387004a7c2 Mon Sep 17 00:00:00 2001
From: Robert Jelic <36573031+NoryiE@users.noreply.github.com>
Date: Tue, 25 Feb 2025 10:02:16 +0100
Subject: [PATCH] Xml Guide
---
docs/guides/xml.md | 141 ++++++++++++++++++++++
docs/references/plugins/pluginTemplate.md | 10 --
2 files changed, 141 insertions(+), 10 deletions(-)
create mode 100644 docs/guides/xml.md
delete mode 100644 docs/references/plugins/pluginTemplate.md
diff --git a/docs/guides/xml.md b/docs/guides/xml.md
new file mode 100644
index 0000000..1ec253f
--- /dev/null
+++ b/docs/guides/xml.md
@@ -0,0 +1,141 @@
+# XML in Basalt
+
+Basalt provides an XML parser that lets you define your UI layout in a declarative way. This can make your code more readable and maintainable.
+
+## Basic Usage
+
+```lua
+local main = basalt.getMainFrame()
+
+-- Load from file
+local xmlFile = fs.open("myUI.xml", "r")
+main:loadXML(xmlFile.readAll())
+xmlFile.close()
+
+-- Or directly as string
+main:loadXML([[
+
+
+
+]])
+```
+
+## Working with Variables
+
+The XML parser uses a scope system to access variables and functions. Any variables you want to use in your XML must be passed in the scope:
+
+```lua
+local scope = {
+ title = "My App",
+ buttonWidth = 10,
+ handleClick = function(self)
+ self:setText("Clicked!")
+ end
+}
+
+main:loadXML([[
+
+
+
+
+]], scope)
+```
+
+## Event Handlers
+
+There are two ways to define event handlers:
+
+### 1. Reference a Function in Scope
+```lua
+local scope = {
+ btnClick = function(self)
+ self:setText("Clicked!")
+ end
+}
+
+main:loadXML([[
+
+]], scope)
+```
+
+### 2. Using CDATA Sections
+```xml
+
+```
+
+## Property Types
+
+The XML parser automatically converts values based on the property type:
+
+```xml
+