mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
xml fix REPORT
This commit is contained in:
@@ -175,7 +175,8 @@ impl Enum {
|
|||||||
}
|
}
|
||||||
Event::Comment(_) => { /* ignore */ }
|
Event::Comment(_) => { /* ignore */ }
|
||||||
Event::Decl(_) => {
|
Event::Decl(_) => {
|
||||||
return Err(::rustical_xml::XmlDeError::UnsupportedEvent("Declaration"));
|
/* ignore */
|
||||||
|
// return Err(::rustical_xml::XmlDeError::UnsupportedEvent("Declaration"));
|
||||||
}
|
}
|
||||||
Event::PI(_) => {
|
Event::PI(_) => {
|
||||||
return Err(::rustical_xml::XmlDeError::UnsupportedEvent("Processing instruction"));
|
return Err(::rustical_xml::XmlDeError::UnsupportedEvent("Processing instruction"));
|
||||||
|
|||||||
@@ -256,3 +256,33 @@ fn test_xml_values() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_struct_xml_decl() {
|
||||||
|
#[derive(Debug, XmlDeserialize, XmlRootTag, PartialEq)]
|
||||||
|
#[xml(root = b"document")]
|
||||||
|
struct Document {
|
||||||
|
child: Child,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, XmlDeserialize, PartialEq, Default)]
|
||||||
|
struct Child {
|
||||||
|
#[xml(ty = "text")]
|
||||||
|
text: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
let doc = Document::parse_str(
|
||||||
|
r#"
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<document><child>Hello!</child></document>"#,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
doc,
|
||||||
|
Document {
|
||||||
|
child: Child {
|
||||||
|
text: "Hello!".to_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user