Merge branch 'Eijebong/minidom-rs-fix_namespaced_attributes'
# Conflicts: # src/tests.rs
This commit is contained in:
commit
c6f9cc485f
2 changed files with 30 additions and 3 deletions
|
|
@ -211,7 +211,15 @@ impl Element {
|
|||
match e {
|
||||
ReaderEvent::StartElement { name, attributes, namespace } => {
|
||||
let attributes = attributes.into_iter()
|
||||
.map(|o| Attribute::new(o.name.local_name, o.value))
|
||||
.map(|o| {
|
||||
Attribute::new(
|
||||
match o.name.prefix {
|
||||
Some(prefix) => format!("{}:{}", prefix, o.name.local_name),
|
||||
None => o.name.local_name
|
||||
},
|
||||
o.value
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let ns = if let Some(ref prefix) = name.prefix {
|
||||
namespace.get(prefix)
|
||||
|
|
@ -219,6 +227,7 @@ impl Element {
|
|||
else {
|
||||
namespace.get(NS_NO_PREFIX)
|
||||
}.map(|s| s.to_owned());
|
||||
|
||||
let mut root = Element::new(name.local_name, ns, attributes, Vec::new());
|
||||
root.from_reader_inner(reader)?;
|
||||
return Ok(root);
|
||||
|
|
@ -237,7 +246,15 @@ impl Element {
|
|||
match e {
|
||||
ReaderEvent::StartElement { name, attributes, namespace } => {
|
||||
let attributes = attributes.into_iter()
|
||||
.map(|o| Attribute::new(o.name.local_name, o.value))
|
||||
.map(|o| {
|
||||
Attribute::new(
|
||||
match o.name.prefix {
|
||||
Some(prefix) => format!("{}:{}", prefix, o.name.local_name),
|
||||
None => o.name.local_name
|
||||
},
|
||||
o.value
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let ns = if let Some(ref prefix) = name.prefix {
|
||||
namespace.get(prefix)
|
||||
|
|
|
|||
Loading…
Reference in a new issue