minidom: ensure prefix is extracted out of provided name when creating Element

I would have liked to handle all of this in `Element::new` only, but I
also have to do it in `Element::builder` unfortunately because then
element builder then pushes prefixes it gathered itself.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-03-28 16:22:37 +01:00
commit 171e7f1f34
2 changed files with 21 additions and 9 deletions

View file

@ -52,6 +52,10 @@ impl Prefixes {
None => None,
}
}
pub(crate) fn insert<S: Into<String>>(&mut self, namespace: S, prefix: Option<String>) {
self.prefixes.insert(namespace.into(), prefix);
}
}
impl From<BTreeMap<String, Option<String>>> for Prefixes {