use-xml 0.1.0

Lightweight XML declaration, element, and attribute helpers for RustUse
Documentation
  • Coverage
  • 68.18%
    15 out of 22 items documented1 out of 15 items with examples
  • Size
  • Source code size: 13.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 489.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 22s Average build duration of successful builds.
  • all releases: 22s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-xml

Practical XML utility primitives for lightweight declaration, element, attribute, escaping, and comment handling.

Warning: versions below 0.3.0 are experimental and may change as the crate matures.

Example Usage

use use_xml::{extract_root_element, get_attribute, has_xml_declaration, strip_xml_comments};

let input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root id=\"42\"><!-- note --></root>";
let root = extract_root_element(input).unwrap();

assert!(has_xml_declaration(input));
assert_eq!(root.name, "root");
assert_eq!(get_attribute("<root id=\"42\" />", "id"), Some("42".to_string()));
assert_eq!(strip_xml_comments("<root><!-- note --><child /></root>"), "<root><child /></root>");

Scope

  • XML declaration detection and conservative extraction
  • root element and attribute inspection helpers
  • XML escaping, unescaping, and comment stripping

Non-Goals

  • a full XML parser
  • XPath support
  • XSD validation
  • deep namespace resolution

License

Licensed under either of the following, at your option:

  • MIT License
  • Apache License, Version 2.0