make Debug on Element return valid XML
This commit is contained in:
parent
7c04aff416
commit
f301f2cb10
1 changed files with 2 additions and 4 deletions
|
@ -31,11 +31,9 @@ pub struct Element {
|
||||||
|
|
||||||
impl fmt::Debug for Element {
|
impl fmt::Debug for Element {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
if let Some(ref ns) = self.namespace {
|
|
||||||
write!(fmt, "<{{{}}}{}", ns, self.name)?;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
write!(fmt, "<{}", self.name)?;
|
write!(fmt, "<{}", self.name)?;
|
||||||
|
if let Some(ref ns) = self.namespace {
|
||||||
|
write!(fmt, " xmlns=\"{}\"", ns)?;
|
||||||
}
|
}
|
||||||
for attr in &self.attributes {
|
for attr in &self.attributes {
|
||||||
write!(fmt, " {}", attr)?;
|
write!(fmt, " {}", attr)?;
|
||||||
|
|
Loading…
Reference in a new issue