Crate xml_data

Source
Expand description

This library provides a generic interface to parse XML data: a user might implement how to parse and serialize their data (possibly derived), while others will implement adaptors for generic XML parsers.

This is similar to what serde does; but serde assumes your data consists of “native data” (strings, integers, floats, …) and nested data (lists and maps). XML doesn’t map to this very well; while there are some adaptors, they often accept lots of structually different input data: an element might be interpreted as map in serde. A subelement with text now can be interpreted as key (<key>value</key>), but an attribute is interpreted the same way <... key="value">.

This library focuses only on XML instead, and provides a more strict interface with clearly defined output.

For the following XML handling crates adaptors are included if enabled through the equally named features:

If the derive feature is enabled the following traits can be derived:

  • Element
  • parser::Element
  • serializer::Element
  • Inner
  • parser::Inner
  • serializer::Inner

Modules§

  • Helper functions to generate common errors
  • Use this to activate all trait extensions without importing their names.
  • Traits and helper structs to parse XML
  • Parser/serializer adaptors using quick-xml
  • Traits and helper structs to serialize XML

Traits§

  • Combining parser::Element and serializer::Element.
  • Combining parser::Inner and serializer::Inner.

Type Aliases§

  • For now we use a simple boxed error to show the user
  • Result alias with out error type included

Derive Macros§

  • Derive xml-data::{parser,serializer}::Element
  • Derive xml-data::{parser,serializer}::Inner