Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.
This repository was archived by the owner on May 6, 2020. It is now read-only.

empty-element tag can't be parsed by codegen #32

@ibotty

Description

@ibotty
#[derive(Deserialize, Debug)]
#[serde(rename="a")]
pub struct A {
    b1: String
}

compiled with serde_codegen::expand(&src, &dst), and

extern crate serde;
extern crate serde_xml;

include!(concat!(env!("OUT_DIR"), "/a.rs"));

fn main() {
    // let deserialized: Result<serde_xml::value::Element, serde_xml::Error> = serde_xml::de::from_str(r"<a><b1>v</b1><b2/></a>");
    let deserialized: Result<A, serde_xml::Error> = serde_xml::de::from_str(r"<a><b1>v</b1><b2/></a>");
    println!("deserialized: {:?}", deserialized);
}

Fails with 'SyntaxError(expected end tag, 1, 22))'. Removing the empty-element tag '' let's it work, as is parsing to serde_xml::value::Element.

That is with

"checksum serde 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)" = "1105e65d0a0b212d2d735c8b5a4f6aba2adc501e8ad4497e9f1a39e4c4ac943e"
"checksum serde_codegen 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)" = "446384bcfd7d9276a23b51e9dc14341909ad05377b68ac5da6f83a7a2094bcd0"
"checksum serde_codegen_internals 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "318f7e77aa5187391d74aaf4553d2189f56b0ce25e963414c951b97877ffdcec"
"checksum serde_xml 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "56346e526b0828da6b7a6a867076a6ae22d188ffd7a5511b4ffbd815def0ba95"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions