Use minidom 0.6.1’s Element::has_ns(), to simplify namespace comparisons.
This commit is contained in:
parent
c853a1ff4b
commit
f69f567448
4 changed files with 4 additions and 8 deletions
|
|
@ -38,8 +38,7 @@ impl TryFrom<Element> for ChatState {
|
|||
type Err = Error;
|
||||
|
||||
fn try_from(elem: Element) -> Result<ChatState, Error> {
|
||||
let ns = elem.ns();
|
||||
if ns.as_ref().map(|ns| ns.as_str()) != Some(ns::CHATSTATES) {
|
||||
if !elem.has_ns(ns::CHATSTATES) {
|
||||
return Err(Error::ParseError("This is not a chatstate element."));
|
||||
}
|
||||
for _ in elem.children() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue