A pure-Lua SAX-like streaming XML parser with optional DOM builder and serialization.
SLAXML is a pure-Lua SAX-like streaming XML parser that reads XML input in a single pass and emits events for elements, attributes, text, and other nodes. It solves the problem of parsing XML in Lua environments where robust, non-pattern-based parsing is needed, especially for documents with namespaces, CDATA, comments, and complex attribute values. The library includes an optional DOM parser for building and manipulating XML as Lua tables, with serialization back to XML.
Lua developers who need to parse, generate, or manipulate XML data within Lua applications, such as those working on game mods, configuration files, data interchange, or tools that process XML-based formats.
Developers choose SLAXML because it is a pure-Lua solution that is more robust than simple pattern-based parsers, correctly handling edge cases like unescaped '>' in attributes and providing both streaming and DOM interfaces. Its optional DOM parser with serialization allows for easy XML manipulation and round-tripping, all without external dependencies.
SAX-like streaming XML parser for Lua
Correctly parses complex XML constructs like unescaped '>' in attributes and CDATA sections, which simpler pattern-based parsers often fail on, as emphasized in the README.
Implemented in a single Lua file (or two with DOM), requiring no external dependencies, making it easy to integrate into Lua projects without setup overhead.
Offers both a streaming SAX parser for low-memory usage on large files and an optional DOM parser with round-trip serialization for easy manipulation and output.
Provides options to strip whitespace and serialize DOM with pretty-printing and attribute sorting, enhancing readability and diff-friendliness, as shown in the examples.
Admits in the README that it allows syntactically-invalid XML without errors, such as mismatched tags or unescaped ampersands, which can lead to incorrect parsing in strict scenarios.
Lacks support for DTDs, XInclude, custom entities, and proper encoding handling, limiting its use with standards-compliant XML that relies on these features.
Serialization can produce invalid XML if namespace prefixes are mismatched, as it ignores nsURI in favor of nsPrefix, requiring manual management of xmlns attributes, as warned in the documentation.
A lightweight JSON library for Lua
A self contained Lua MessagePack C implementation.
Lua Protocol Buffers
A port of LPeg 100% written in Lua.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.