You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put together an MCVE crate but I'll copy the relevant parts here:
I tried this code:
use serde::Deserialize;#[derive(Debug,Deserialize)]structFoo{#[serde(rename = "$value")]value:String,}fnmain(){run_test("bad test case",b"<foo><![CDATA[<p>bar</p>]]></foo>");run_test("working test case",b"<foo><p>bar</p></foo>");}fnrun_test(name:&str,test_case:&[u8]){let foo_result:Result<Foo,_> = quick_xml::de::from_reader(test_case);println!("{} as Foo: {:?}", name, foo_result);let string_result:Result<String,_> = quick_xml::de::from_reader(test_case);println!("{} as bare string: {:?}", name, string_result);println!();}
and it produced this output:
bad test case as Foo: Err(Custom("missing field `$value`"))
bad test case as bare string: Ok("<p>bar</p>")
working test case as Foo: Ok(Foo { value: "<p>bar</p>" })
working test case as bare string: Ok("<p>bar</p>")
I expected to see:
bad test case as Foo: Ok(Foo { value: "<p>bar</p>" })
bad test case as bare string: Ok("<p>bar</p>")
working test case as Foo: Ok(Foo { value: "<p>bar</p>" })
working test case as bare string: Ok("<p>bar</p>")
The text was updated successfully, but these errors were encountered:
This bug is fixed by #374 which is merged in my fork https://github.com/Mingun/fast-xml. This project seems abandoned, so it's time to switch! I'll release 0.23 with this fix soon.
Thanks, I appreciate what you're doing! For the time being, I've moved away from serde-based XML deserializers, am currently trying out strong-xml, but it's good that someone is picking this back up.
Put together an MCVE crate but I'll copy the relevant parts here:
I tried this code:
and it produced this output:
I expected to see:
The text was updated successfully, but these errors were encountered: