Expand description
§tinyxml2
A ground-up Rust implementation of the TinyXML2 API — behavioral compatibility with idiomatic Rust internals.
§Overview
tinyxml2 provides a lightweight, DOM-based XML parser and serializer that
is behaviorally compatible with the C++ TinyXML2 library. TinyXML2 is treated
as the specification — this crate matches its parsing semantics,
serialization output, entity handling, and error behavior while using Rust’s
type system, ownership model, and standard library conventions internally.
§What this crate is NOT
- Not a wrapper around the C++ TinyXML2 library
- Not a line-by-line translation of C++ code
- Not a fork — it is an entirely new implementation
§Architecture
The DOM is backed by a generational arena allocator where the Document
owns all nodes. This matches TinyXML2’s ownership model (XMLDocument owns
everything) while providing Rust’s memory safety guarantees without unsafe.
§Modules
| Module | Purpose |
|---|---|
error | Error types compatible with TinyXML2’s error codes |
entity | XML entity encoding and decoding |
util | Character classification and string utilities |
arena | Generational arena allocator for DOM nodes |
§Status
This crate is under active development. See the roadmap for the current implementation phase.
Re-exports§
pub use arena::NodeId;pub use document::Document;pub use error::ParseErrorKind;pub use error::Result;pub use error::XmlError;pub use node::Attribute;pub use node::ElementData;pub use node::NodeData;pub use node::NodeKind;pub use node::TextData;pub use printer::XmlPrinter;pub use visitor::XmlVisitor;
Modules§
- arena
- Generational arena allocator for DOM nodes.
- document
- XML document container and DOM tree manipulation.
- entity
- XML entity encoding and decoding.
- error
- XML error types compatible with TinyXML2’s error codes.
- node
- XML DOM node types.
- printer
- XML output serialization and streaming printer.
- typed
- Typed attribute and text parsing implementations on Document.
- util
- XML utility functions for character classification and string helpers.
- visitor
- XML Visitor pattern for DOM traversal.
Structs§
- Parse
Options - Options for parsing XML documents.
Enums§
- Whitespace
- Whitespace handling mode, matching TinyXML2’s
Whitespaceenum.
Type Aliases§
- Printer
- Type alias for
XmlPrinterto maintain compatibility with C++ naming conventions.