message: Fix wrong element for xml:lang.

This commit is contained in:
Emmanuel Gil Peyrot 2017-08-27 01:21:07 +01:00
parent f69f567448
commit 833ef068c6

View file

@ -168,7 +168,7 @@ impl TryFrom<Element> for Message {
for _ in elem.children() { for _ in elem.children() {
return Err(Error::ParseError("Unknown child in body element.")); return Err(Error::ParseError("Unknown child in body element."));
} }
let lang = get_attr!(root, "xml:lang", default); let lang = get_attr!(elem, "xml:lang", default);
let body = Body(elem.text()); let body = Body(elem.text());
if bodies.insert(lang, body).is_some() { if bodies.insert(lang, body).is_some() {
return Err(Error::ParseError("Body element present twice for the same xml:lang.")); return Err(Error::ParseError("Body element present twice for the same xml:lang."));
@ -177,7 +177,7 @@ impl TryFrom<Element> for Message {
for _ in elem.children() { for _ in elem.children() {
return Err(Error::ParseError("Unknown child in subject element.")); return Err(Error::ParseError("Unknown child in subject element."));
} }
let lang = get_attr!(root, "xml:lang", default); let lang = get_attr!(elem, "xml:lang", default);
let subject = Subject(elem.text()); let subject = Subject(elem.text());
if subjects.insert(lang, subject).is_some() { if subjects.insert(lang, subject).is_some() {
return Err(Error::ParseError("Subject element present twice for the same xml:lang.")); return Err(Error::ParseError("Subject element present twice for the same xml:lang."));