Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

xs:list deserialization does not split on all whitespace #839

Open
yuriks opened this issue Jan 17, 2025 · 0 comments
Open

xs:list deserialization does not split on all whitespace #839

yuriks opened this issue Jan 17, 2025 · 0 comments
Labels
arrays Issues related to mapping XML content onto arrays using serde bug help wanted serde Issues related to mapping from Rust types to XML

Comments

@yuriks
Copy link

yuriks commented Jan 17, 2025

Despite the documentation explicitly mentioning that "According to the XML Schema specification, delimiters for elements is one or more space ( , \r, \n, and \t) character(s).", ListIter only actually splits on (space): simple_type.rs.

Reproducer:

use serde::Deserialize;
use quick_xml::de::from_str;

#[derive(Deserialize)]
struct Root {
    #[serde(rename = "$text")]
    items: Vec<String>,
}

fn main() {
    const TEST_XML: &str = "<Root>one two\nthree four\tfive six</Root>";

    let root: Root = from_str(TEST_XML).unwrap();
    assert_eq!(
        root.items,
        ["one", "two", "three", "four", "five", "six"]
    );
    // assertion `left == right` failed
    //  left: ["one", "two\nthree", "four\tfive", "six"]
    // right: ["one", "two", "three", "four", "five", "six"]
}
@Mingun Mingun added bug help wanted serde Issues related to mapping from Rust types to XML arrays Issues related to mapping XML content onto arrays using serde labels Jan 18, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
arrays Issues related to mapping XML content onto arrays using serde bug help wanted serde Issues related to mapping from Rust types to XML
Projects
None yet
Development

No branches or pull requests

2 participants