Map default xml prefix
This commit is contained in:
parent
2b691c5131
commit
a199cc7b5c
|
@ -185,6 +185,13 @@ impl<'xml> Context<'xml> {
|
|||
}
|
||||
|
||||
fn lookup(&self, prefix: &str) -> Option<&'xml str> {
|
||||
// The prefix xml is by definition bound to the namespace
|
||||
// name http://www.w3.org/XML/1998/namespace
|
||||
// See https://www.w3.org/TR/xml-names/#ns-decl
|
||||
if prefix == "xml" {
|
||||
return Some("http://www.w3.org/XML/1998/namespace");
|
||||
}
|
||||
|
||||
self.stack
|
||||
.iter()
|
||||
.rev()
|
||||
|
|
|
@ -34,6 +34,12 @@ fn default_namespaces() {
|
|||
Ok(NestedDe { flag: true })
|
||||
);
|
||||
|
||||
// Default namespace not-nested - with xml:lang
|
||||
assert_eq!(
|
||||
from_str("<NestedDe xml:lang=\"en\" xmlns=\"URI\" xmlns:bar=\"BAZ\"><bar:flag>true</bar:flag></NestedDe>"),
|
||||
Ok(NestedDe { flag: true })
|
||||
);
|
||||
|
||||
// Default namespace not-nested - wrong namespace
|
||||
assert_eq!(
|
||||
from_str(
|
||||
|
|
Loading…
Reference in New Issue