diff --git a/parsers/src/jingle.rs b/parsers/src/jingle.rs index abdb5dd2..5256a51f 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 23b9d155..0eecf8a9 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 35fd173b..98b901bb 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 2242e8de..4e992e89 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 602aff18..8208378e 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 42214c23..a5e04cc9 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 082dfd83..7ba5209b 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 ad2f1500..317f131d 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