mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 01:12:24 +00:00
xml: Support CDATA
This commit is contained in:
@@ -257,6 +257,34 @@ fn test_xml_values() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_xml_cdata() {
|
||||
#[derive(XmlDeserialize, XmlRootTag, PartialEq, Debug)]
|
||||
#[xml(root = b"document")]
|
||||
struct Document {
|
||||
#[xml(ty = "text")]
|
||||
hello: String,
|
||||
href: String,
|
||||
}
|
||||
|
||||
let doc = Document::parse_str(
|
||||
r#"
|
||||
<document>
|
||||
<![CDATA[some text]]>
|
||||
<href><![CDATA[some stuff]]></href>
|
||||
</document>
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
doc,
|
||||
Document {
|
||||
hello: "some text".to_owned(),
|
||||
href: "some stuff".to_owned()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_struct_xml_decl() {
|
||||
#[derive(Debug, XmlDeserialize, XmlRootTag, PartialEq)]
|
||||
|
||||
Reference in New Issue
Block a user