Communication & Formats ยท zero-dependency ยท MIT

larzxml

Ergonomic XML builder + XXE-safe parser.

A fluent XML builder that escapes correctly, and a parser that refuses DTDs and entity declarations - so XML external-entity (XXE) and billion-laughs expansion attacks simply can't happen. Safe by construction, not by discipline.

larzscript pkg install xml
View on GitHub →Learn the stack

What you get

Try it

import "xml" as xml
let doc = xml.element("root", {}, [
  xml.element("item", {"id": "1"}, [xml.text("Hello & welcome")])
])
print(xml.to_string(doc))
let parsed = xml.parse(xml.to_string(doc))
print(xml.find(parsed, "item")["attrs"]["id"])
Output
<root><item id="1">Hello &amp; welcome</item></root>
1

Why it's in the Larz Stack

larzxml is a real Larzscript package (larzscript pkg install xml) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.