https://github.com/vorgestern/xmlrep
Lua module to export structured data in xml-form
https://github.com/vorgestern/xmlrep
lua serialise xml
Last synced: about 1 year ago
JSON representation
Lua module to export structured data in xml-form
- Host: GitHub
- URL: https://github.com/vorgestern/xmlrep
- Owner: vorgestern
- Created: 2024-12-08T17:23:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-16T00:10:40.000Z (over 1 year ago)
- Last Synced: 2025-02-16T01:17:14.769Z (over 1 year ago)
- Topics: lua, serialise, xml
- Language: Lua
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# xmlrep
## Purpose
Export structured data from Lua in xml-form
Xmlrep makes it easy to create 'domain-specific' utilities
to establish default-attributes or parameterised node-structures
in the Lua representation of a data structure.
A Lua file is typically easier to keep under version control than
an application-specific xml-file, because applications usually include
extraneous information (e.g. 'last-modified' timestamps).
## Status
Works as intended
### Missing features
- Creating attributes directly from generic Lua-tables (alphabetic order)
- Escaping Text properly
- xml entities
- xml namespace
### Defects
- Indentation after textnodes that are terminated with a newline
## How to use
local X=require "xmlrep"
local N,A,T=X.N,X.A,X.T -- Abbreviate Node, Attribute, Textnode
-- (Attributes and Textnodes may not be necessary,
-- since they can be created implicitly.)
local Readme=N "Readme" {"version=0.1"} {
N "Level1" {"index=0", "version=0.1"} {
N "Level2" {} {
},
N "Level2" {} {
}
}
}
print(Readme) -- Print xml-representation
### More complex examples
outputs xml-text ..
lua examples/Readme.lua .. with roughly the same content as this Readme.
lua examples/Demoproject.lua .. of a project file for Visual Studio (.vcxproj).
lua examples/Mindmap.lua .. of a mindmap for Freeplane (https://github.com/freeplane/freeplane)
lua examples/qtui/coverdialog.lua .. of a resource-file for a Qt-application
lua examples/qtui/findmpddialog.lua .. of a resource-file for a Qt-application
## How to build
There is no need to build xmlrep,
since it can be used in source-form.
## How to install
Copy xmlrep.lua to a directory on your Luapath.
Consult LUA_PATH_5_4 or LUA_PATH environment variables
or https://www.lua.org/manual/5.4/manual.html#pdf-package.path