Crate xml_data_derive

Source
Expand description

Derive xml-data trait implementations

Deriving supports the following attributes on the struct:

  • #[xml_data(tag("..."))]: XML tag (only for deriving Element); defaults to struct name
  • #[xml_data(crate(...))]: Name of xml-data crate in local scope; defaults to xml_data
  • #[xml_data(ignore_unknown)]: Ignore unhandled/unknown attributes, inner nodes and inner text (only for deriving Element; Inner never fails for unknown data)

And the following attributes on struct fields:

  • #[xml(attr)]: Mark field as attribute for containing XML element (only for deriving Element`)
  • #[xml(attr("..."))]: Mark field as attribute for containing XML element with given key (only for deriving Element`)
  • #[xml(attr_string)]: Mark field as string attribute (using ValueStringinstead ofValueDefault) for containing XML element (only for deriving Element`)

Multiple attributes can be combined like #[xml(tag("..."), ignore_unknown)].

Derive Macrosยง