#xmpp #dom #xml

minidom

A small, simple DOM implementation on top of rxml, targeting the subset of XML useful for XMPP

32 releases (17 breaking)

0.18.0 Oct 28, 2025
0.16.0 Jul 23, 2024
0.15.2 May 13, 2023
0.15.1 Jan 15, 2023
0.1.1 Feb 25, 2017

#874 in Data structures

Download history 47257/week @ 2026-02-16 46136/week @ 2026-02-23 52892/week @ 2026-03-02 57133/week @ 2026-03-09 40508/week @ 2026-03-16 41415/week @ 2026-03-23 42335/week @ 2026-03-30 40505/week @ 2026-04-06 48092/week @ 2026-04-13 47248/week @ 2026-04-20 40683/week @ 2026-04-27 50023/week @ 2026-05-04 48934/week @ 2026-05-11 62403/week @ 2026-05-18 40937/week @ 2026-05-25 45820/week @ 2026-06-01

203,903 downloads per month
Used in 75 crates (48 directly)

MPL-2.0 license

77KB
1.5K SLoC

minidom

What's this?

A minimal DOM library on top of rxml, targeting exclusively the subset of XML useful for XMPP.

Restriction Supported ✅ Unsupported ❌
Namespaces are mandatory <a xmlns="ns"></a> <a></a>

lib.rs:

A minimal DOM crate built on top of rxml, targeting exclusively the subset of XML useful for XMPP.

This library exports an Element struct which represents a DOM tree.

Example

Run with cargo run --example articles. Located in examples/articles.rs.

extern crate minidom;

use minidom::Element;

const DATA: &'static str = r#"<articles xmlns="article">
    <article>
        <title>10 Terrible Bugs You Would NEVER Believe Happened</title>
        <body>
            Rust fixed them all. &lt;3
        </body>
    </article>
    <article>
        <title>BREAKING NEWS: Physical Bug Jumps Out Of Programmer's Screen</title>
        <body>
            Just kidding!
        </body>
    </article>
</articles>"#;

const ARTICLE_NS: &'static str = "article";

#[derive(Debug)]
pub struct Article {
    title: String,
    body: String,
}

fn main() {
    let root: Element = DATA.parse().unwrap();

    let mut articles: Vec<Article> = Vec::new();

    for child in root.children() {
        if child.is("article", ARTICLE_NS) {
            let title = child.get_child("title", ARTICLE_NS).unwrap().text();
            let body = child.get_child("body", ARTICLE_NS).unwrap().text();
            articles.push(Article {
                title: title,
                body: body.trim().to_owned(),
            });
        }
    }

    println!("{:?}", articles);
}

Usage

To use minidom, add this to your Cargo.toml under dependencies:

minidom = "*"

Dependencies

~1.2–1.7MB
~35K SLoC