xmb
Extensible Markup Builder
A tiny XML builder for Gleam.
let html =
x("greeting", [], [text("Hello, Joe!")])
|> render
|> string_tree.to_string
assert html == "<greeting>Hello, Joe!</greeting>"
This package doesn’t do much. If you’d like more features, check out these alternatives:
Types
Values
pub fn cdata(content: String) -> Xml
Create a XML text node as CDATA rather than escaping XML entities. This is often easier to read and will render slightly faster.
pub fn dangerous_unescaped_fragment(s: StringTree) -> Xml
Dangerously inject some string content into the XML document. This will not be escaped! Your string must be valid XML syntax! Do not mess up!
pub fn render_fragment(element: Xml) -> StringTree
Render XML to a fragment, that is a XML document without an XML declaration.