Skip to content

Instantly share code, notes, and snippets.

@EarlGray
Created July 17, 2023 10:15
Show Gist options
  • Save EarlGray/c51c71718993ab32389ed7f17ddad738 to your computer and use it in GitHub Desktop.
Save EarlGray/c51c71718993ab32389ed7f17ddad738 to your computer and use it in GitHub Desktop.

Parsers and DOM

  • xml-rs: roughly XML 1.0, low-level StAX-style streaming parser; no DTD validation;
  • xmlparser: very similar to xml-rs
  • quick-xml: almost zero-copy,
  • roxmltree: a read-only zero-copy "DOM" based on the source data. Not streaming? XML 1.0.
  • rxml: "alpha-quality" restricted SAX parsing of XML 1.0 with namespacing.
    • minidom builds on it, focused on xmpp
    • domino is like minidom, but is supposed to be more general-purpose.
  • html5ever "browser-grade" by Mozilla for Servo.
    • xml5ever : alpha-quality, based on html5ever; pretty popular nonetheless

Schemas

  • xsd-types only XSD types, very incomplete (only numeric types at the moment)
  • xml-schema is based on xml-rs and allows:
    #[derive(XmlSchema)]
    #[xml_schema(source="schema.xsd", ...)]
  • xsd-parser-rs can parse .xsd files into structs. No code generation there.
  • rust-xml-schema parses xsd files using xml-schema and does code generation using carllerche/codegen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment