| Crates.io | facet-xml-node |
| lib.rs | facet-xml-node |
| version | 0.43.1 |
| created_at | 2026-01-22 16:54:40.972629+00 |
| updated_at | 2026-01-23 08:54:37.204757+00 |
| description | Raw XML node types for facet-xml - represent arbitrary XML without a schema |
| homepage | |
| repository | https://github.com/facet-rs/facet |
| max_upload_size | |
| id | 2062167 |
| size | 38,630 |
Raw XML node types—represent arbitrary XML without a schema.
This crate provides generic XML types (Element, Content) that can represent
any XML document without needing predefined Rust structs. It's useful when you
need to parse XML dynamically or work with XML of unknown structure.
Captures any XML element with its tag name, attributes, and children:
use facet_xml_node::Element;
let xml = r#"<item id="42" status="active">Hello <b>world</b></item>"#;
let element: Element = facet_xml::from_str(xml)?;
assert_eq!(element.tag, "item");
assert_eq!(element.attrs.get("id"), Some(&"42".to_string()));
Represents either text or a child element:
use facet_xml_node::{Element, Content};
for child in &element.children {
match child {
Content::Text(t) => println!("Text: {}", t),
Content::Element(e) => println!("Element: <{}>", e.tag),
}
}
| Approach | Use Case |
|---|---|
Typed structs with #[derive(Facet)] |
Known XML schema, compile-time safety |
facet-xml-node::Element |
Unknown/dynamic XML, runtime flexibility |
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
The facet logo was drawn by Misiasart.
Licensed under either of:
at your option.