chatstates: Use the new helper macros to simplify parsing.

This commit is contained in:
Emmanuel Gil Peyrot 2017-10-10 18:09:58 +01:00
commit ee243c4720
2 changed files with 11 additions and 9 deletions

View file

@ -138,6 +138,14 @@ macro_rules! check_self {
);
}
macro_rules! check_ns_only {
($elem:ident, $name:tt, $ns:expr) => (
if !$elem.has_ns($ns) {
return Err(Error::ParseError(concat!("This is not a ", $name, " element.")));
}
);
}
macro_rules! check_no_children {
($elem:ident, $name:tt) => (
for _ in $elem.children() {