Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

UnexpectedToken Error decoding xml that has a <br /> tag in it (fetched from a jenkins config.xml) #215

Open
merc1031 opened this issue Aug 13, 2024 · 0 comments

Comments

@merc1031
Copy link

I fetch a more complex config.xml from jenkins, and distilled it down to this test case.

simplified xml test_failing_description.xml

<?xml version="1.0" encoding="UTF-8"?><project>
    <description>
  <br/>
    Text
    </description>
</project>  

test

    #[rstest]
    fn test_failing_description() {
        #[derive(Debug, Deserialize)]
        #[serde(rename_all = "camelCase")]
        pub struct SimpleProject {
            pub description: String,
        }

        let d: PathBuf = [
            env!("CARGO_MANIFEST_DIR"),
            "test_resources",
            "jenkins",
            "xml",
            "job",
            "test_failing_description.xml",
        ]
        .iter()
        .collect();
        let xml = fs::read_to_string(d).expect("Unable to read file");
        let job: SimpleProject = serde_xml_rs::from_str(&xml).unwrap();
        println!("{:?}", job);
    }

error

    thread 'jenkins::xml::job::tests::test_failing_description' panicked at src/jenkins/xml/job.rs:766:63:
called `Result::unwrap()` on an `Err` value: UnexpectedToken { token: "XmlEvent::Characters(s)", found: "StartElement(br, {\"\": \"\", \"xml\": \"http://www.w3.org/XML/1998/namespace\", \"xmlns\": \"http://www.w3.org/2000/xmlns/\"})" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant