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
Hi! I'm using quick_xml to deserialize to some serde structs. While I'm still developing the structs against the XML, it happens that I have mismatches between my structs and the XML. If that happens instead of getting an error like "Expected type X at location Y", I get a pretty cryptic error, specifically:
called `Result::unwrap()` on an `Err` value: UnexpectedStart([116, 101, 120, 116])
Which doesn't give me much information to start debugging, about where the issue is, or even what it is.
A real-life-inspired reproduction that creates this error is as follows:
let xml = r#"<?xml version='1.0' encoding='UTF-8'?> <outerTag> <generalComment> <text xml:lang="en" index="0">some text</text> </generalComment> </outerTag> "#;#[derive(Deserialize)]pubstructXmlRoot{// Oops you thought this was a string but it's notgeneralComment:String,}// Error: Unexpected startlet result = quick_xml::de::from_str::<XmlRoot>(xml).unwrap();
The text was updated successfully, but these errors were encountered:
GeeWee
changed the title
Cryptic error UnexpectedStart if schema does not match
Cryptic error UnexpectedStart if serde structs do not match XML
Dec 13, 2024
Hi! I'm using quick_xml to deserialize to some serde structs. While I'm still developing the structs against the XML, it happens that I have mismatches between my structs and the XML. If that happens instead of getting an error like "Expected type X at location Y", I get a pretty cryptic error, specifically:
Which doesn't give me much information to start debugging, about where the issue is, or even what it is.
A real-life-inspired reproduction that creates this error is as follows:
The text was updated successfully, but these errors were encountered: