Skip to content

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

@yuriks

Description

@yuriks

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"]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraysIssues related to mapping XML content onto arrays using serdebughelp wantedserdeIssues related to mapping from Rust types to XML

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions