[][src]Macro rapid_xml::xml_path

macro_rules! xml_path {
    ($tag_name:literal => $t:ty) => { ... };
    (* => $t:ty) => { ... };
    ($tag_name:literal) => { ... };
    (*) => { ... };
    ($tag_name:literal => $t:ty, $($r_tag_name:tt $(=> $r_t:ty)?),+) => { ... };
    (* => $t:ty, $($r_tag_name:tt $(=> $r_t:ty)?),+) => { ... };
    ($tag_name:literal, $($r_tag_name:tt $(=> $r_t:ty)?),+) => { ... };
    (*, $($r_tag_name:tt $(=> $r_t:ty)?),+) => { ... };
}

Macro for easier construction of XML path.

This macro is alternative to building path by manually creating and nesting ElementEnter, ElementDeserialize and ElementEnterDeserialize.

You can use * (not "*"!) to match any tag. Partial matching is currently not supported!

The last element must deserialize into a type!

Example

let path = xml_path!("aaa", *, "ccc" => Ccc, "ddd", * => Eee);

This will enter tags <aaa ...>, inside enter any tag, inside enter and deserialize <ccc ...> tag into Ccc type, enter <ddd ...> tag tag and finaly deserialize any tag into Eee` type.

The TreeDeserializer with this path will be Iterator over Result<(Ccc, Eee), _> type.