Helium is a comprehensive, high-performance XML toolkit for the Go programming language. It provides a native Go implementation of features traditionally associated with libxml2 and libxslt, including DOM parsing, SAX2 events, XPath (1.0 and 3.1), XSLT 3.0, and multiple validation engines (XSD, RELAX NG, Schematron) README.md7-22
The project emphasizes performance, achieving parsing speeds that exceed Go's standard encoding/xml package and, in some cases, surpass libxml2 via cgo integration README.md109-129
Helium is designed as a tiered hierarchy of packages, ranging from low-level utilities to complex composition and application layers .claude/docs/dependencies.md39-57 It avoids global state and manual memory management common in C libraries by embracing Go idioms such as fluent APIs and the use of context.Context for configuration .claude/docs/packages.md9-11 .claude/docs/packages.md54-56
The following diagram bridges the "Natural Language Space" — the conceptual operations users want to perform — to the specific code entities and packages within Helium that implement these capabilities:
Diagram: System Responsibility to Code Entity Mapping
Sources: README.md7-22 .claude/docs/packages.md9-12 .claude/docs/packages.md40-42 .claude/docs/packages.md48-50 .claude/docs/packages.md69-72 .claude/docs/packages.md143-145 .claude/docs/packages.md36-38 .claude/docs/packages.md115-117 .claude/docs/packages.md133-135
Helium organizes its codebase into distinct layers, each serving a clear role to manage complexity and dependencies .claude/docs/dependencies.md39-57:
| Layer | Responsibility | Key Packages |
|---|---|---|
| Leaf | Low-level utilities including encodings, constants. | internal/encoding, internal/lexicon, enum, sink, push, internal/strcursor |
| Core | Core XML parsing, DOM tree management, SAX2 events. | helium (root package), sax |
| Processing | Fundamental DOM operations: querying, canonicalizing, HTML parsing, streaming output. | xpath1, xpath3, c14n, html, catalog, stream, xmlenc1, relaxng |
| Composition | Complex engines built atop processing: transformation, validation, inclusion, compatibility. | xslt3, xsd, schematron, xinclude, shim, xpointer, xmldsig1 |
| Application | Command-line interface tooling. | cmd/helium (CLI executable), internal/cli/heliumcmd (CLI implementation) |
Diagram: Tiered Dependency Hierarchy
Sources: .claude/docs/dependencies.md1-57
The root helium package is the foundation of the toolkit, providing a fluent Parser interface via NewParser() that generates a full DOM tree implementing the Node interface .claude/docs/packages.md9-12 .claude/docs/packages.md21 It supports a wide array of parsing options such as error recovery, entity substitution, DTD loading, and security toggles like BlockXXE .claude/docs/packages.md10
The DOM is fully featured with all standard node types (Element, Attribute, Text, CDATA, etc.), namespace handling, and serialization through NewWriter() or convenience functions like WriteString() .claude/docs/packages.md13-20
For practical examples on parsing, serializing, and CLI usage, see Getting Started.
Helium ships two XPath implementations:
xpath1: a stable XPath 1.0 engine including all 13 axes and core functions, useful for legacy compatibility and as a dependency for validation engines .claude/docs/packages.md48-62xpath3: a modern XPath 3.1 engine supporting rich expressions, FLWOR, maps, arrays, high-order functions, and a VM-based evaluator .claude/docs/packages.md69-84The xslt3 package provides an XSLT 3.0 transformation engine featuring stylesheet compilation, template and pattern support, streaming transformation analysis, and output serialization mechanisms README.md89 .claude/docs/packages.md143-145
Helium supports three major XML validation standards:
Helium aims for strong feature parity with libxml2 while embracing idiomatic Go design:
xmlInitParser equivalent) .claude/docs/libxml2-parity.md118Helium maintains a comprehensive test suite against libxml2-compat golden files and W3C test sets, carefully documenting both parity and intentional gaps such as stricter duplicate namespace rejection .claude/docs/libxml2-parity.md1-73
For an in-depth comparison, refer to libxml2 Parity and Intentional Divergences.
The module includes the cmd/helium command-line tool, which wraps the library to offer subcommands for linting XML, evaluating XPath expressions, running XSLT transformations, and validating documents against supported schemas README.md91-104 The CLI implementation resides in internal/cli/heliumcmd and integrates all major sub-packages .claude/docs/dependencies.md6-7
For installation and usage details, consult Getting Started, and for CLI-specific documentation see CLI Tool (cmd/helium).
Child Pages:
Sources: README.md7-129 .claude/docs/packages.md3-145 .claude/docs/dependencies.md1-57 .claude/docs/libxml2-parity.md1-134
Refresh this wiki
This wiki was recently refreshed. Please wait 1 day to refresh again.