diff --git a/src/jingle.rs b/src/jingle.rs index 8bca605..8d7d309 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -120,6 +120,7 @@ impl TryFrom for Content { fn try_from(elem: Element) -> Result { check_self!(elem, "content", JINGLE); + check_no_unknown_attributes!(elem, "content", ["creator", "disposition", "name", "senders"]); let mut content = Content { creator: get_attr!(elem, "creator", required), @@ -146,6 +147,8 @@ impl TryFrom for Content { return Err(Error::ParseError("Content must not have more than one security.")); } content.security = Some(child.clone()); + } else { + return Err(Error::ParseError("Unknown child in content element.")); } } Ok(content) @@ -341,6 +344,7 @@ impl TryFrom for Jingle { fn try_from(root: Element) -> Result { check_self!(root, "jingle", JINGLE, "Jingle"); + check_no_unknown_attributes!(root, "Jingle", ["action", "initiator", "responder", "sid"]); let mut jingle = Jingle { action: get_attr!(root, "action", required), diff --git a/src/jingle_s5b.rs b/src/jingle_s5b.rs index 79949d7..fe9eaa1 100644 --- a/src/jingle_s5b.rs +++ b/src/jingle_s5b.rs @@ -111,6 +111,7 @@ impl TryFrom for Transport { fn try_from(elem: Element) -> Result { check_self!(elem, "transport", JINGLE_S5B); + check_no_unknown_attributes!(elem, "transport", ["sid", "dstaddr", "mode"]); let sid = get_attr!(elem, "sid", required); let dstaddr = get_attr!(elem, "dstaddr", optional); let mode = get_attr!(elem, "mode", default);