diff --git a/parsers/src/jingle.rs b/parsers/src/jingle.rs index abdb5dd278265f3e1223115d5008326dc88a5b92..5256a51f6263497dc72e1ff235fcd5e0f385e597 100644 --- a/parsers/src/jingle.rs +++ b/parsers/src/jingle.rs @@ -473,7 +473,7 @@ pub struct ReasonElement { /// A human-readable description of this reason. #[xml(extract(n = .., namespace = ns::JINGLE, name = "text", fields( - attribute(type_ = String, name = "xml:lang", default), + lang(type_ = Lang, default), text(type_ = String), )))] pub texts: BTreeMap, diff --git a/parsers/src/jingle_ft.rs b/parsers/src/jingle_ft.rs index 23b9d1557f22b0a3072c35e88c861174b0257df3..0eecf8a9e9b09b0d9f61866a4dd66e100b4a609a 100644 --- a/parsers/src/jingle_ft.rs +++ b/parsers/src/jingle_ft.rs @@ -58,7 +58,7 @@ pub struct File { /// The description of this file, possibly localised. #[xml(extract(n = .., name = "desc", fields( - attribute(name = "xml:lang", type_ = String), + lang(type_ = Lang, default), text(type_ = String) )))] pub descs: BTreeMap, diff --git a/parsers/src/message.rs b/parsers/src/message.rs index 35fd173b198406944870e576f81d8a08898faa2f..98b901bbd50a39318c55617f92a01295356d34c8 100644 --- a/parsers/src/message.rs +++ b/parsers/src/message.rs @@ -167,7 +167,7 @@ pub struct Message { /// A list of bodies, sorted per language. Use /// [get_best_body()](#method.get_best_body) to access them on reception. #[xml(extract(n = .., name = "body", fields( - attribute(name = "xml:lang", type_ = Lang, default), + lang(type_ = Lang, default), text(type_ = String), )))] pub bodies: BTreeMap, @@ -176,7 +176,7 @@ pub struct Message { /// [get_best_subject()](#method.get_best_subject) to access them on /// reception. #[xml(extract(n = .., name = "subject", fields( - attribute(name = "xml:lang", type_ = Lang, default), + lang(type_ = Lang, default), text(type_ = String), )))] pub subjects: BTreeMap, diff --git a/parsers/src/presence.rs b/parsers/src/presence.rs index 2242e8de87f0141e498c850e11a32ca4c88e10fc..4e992e8965a6f3ecae92b662d12a858b498adc9f 100644 --- a/parsers/src/presence.rs +++ b/parsers/src/presence.rs @@ -163,7 +163,7 @@ pub struct Presence { /// A localised list of statuses defined in this presence. #[xml(extract(n = .., name = "status", fields( - attribute(type_ = Lang, name = "xml:lang", default), + lang(type_ = Lang, default), text(type_ = String), )))] pub statuses: BTreeMap, diff --git a/parsers/src/sasl.rs b/parsers/src/sasl.rs index 602aff180388c51e98291b31557f16dba8ef336c..8208378e594860b40bc3e19a22faeb85eedb41a1 100644 --- a/parsers/src/sasl.rs +++ b/parsers/src/sasl.rs @@ -157,7 +157,7 @@ pub struct Failure { /// A human-readable explanation for the failure. #[xml(extract(n = .., name = "text", fields( - attribute(type_ = String, name = "xml:lang", default), + lang(type_ = Lang, default), text(type_ = String), )))] pub texts: BTreeMap, diff --git a/parsers/src/spam_reporting.rs b/parsers/src/spam_reporting.rs index 42214c238dca078a79b2568e2cdd770c6ea1d33c..a5e04cc98218c1b5c48a1e84f288ce11fc01b70b 100644 --- a/parsers/src/spam_reporting.rs +++ b/parsers/src/spam_reporting.rs @@ -37,7 +37,7 @@ pub struct Report { /// Some text explaining the reason for this report. #[xml(extract(n = .., name = "text", fields( - attribute(name = "xml:lang", type_ = Lang), + lang(type_ = Lang, default), text(type_ = String) )))] texts: BTreeMap, diff --git a/parsers/src/stanza_error.rs b/parsers/src/stanza_error.rs index 082dfd839314236a31b80a094ab898d1c5f20426..7ba5209b290b05406fecc6e3cf29d8ead2af072c 100644 --- a/parsers/src/stanza_error.rs +++ b/parsers/src/stanza_error.rs @@ -245,7 +245,7 @@ pub struct StanzaError { /// Human-readable description of this error. #[xml(extract(n = .., namespace = ns::XMPP_STANZAS, name = "text", fields( - attribute(name = "xml:lang", type_ = Lang, default), + lang(type_ = Lang, default), text(type_ = String), )))] pub texts: BTreeMap, diff --git a/parsers/src/stream_error.rs b/parsers/src/stream_error.rs index ad2f1500efaef4c811f066ccaff42f68611373b8..317f131d7bfe9a260e718fa4c874fa90858c034d 100644 --- a/parsers/src/stream_error.rs +++ b/parsers/src/stream_error.rs @@ -307,7 +307,10 @@ pub struct StreamError { /// Optional error text. The first part is the optional `xml:lang` /// language tag, the second part is the actual text content. - #[xml(extract(default, fields(attribute(name = "xml:lang", default, type_ = Option), text(type_ = String))))] + #[xml(extract(default, fields( + lang(type_ = Option, default), + text(type_ = String), + )))] pub text: Option<(Option, String)>, /// Optional application-defined element which refines the specified