Skip to content

XML serialization of empty elements #121

@Devasta

Description

@Devasta

If you write a simple serialization test like:

#[test]
fn mytest() {

        let s = "<doc/>";
        let d = xml::parse(RNode::new_document(), s, None).unwrap();

        assert_eq!(d.to_xml().to_string(), "<doc/>")

}

You get:

assertion left == right failed
left: "<doc></doc>"
right: "<doc/>"

Although this makes no real difference to how other systems will parse the document, it isn't what most people would expect to return. It would be good if this could be adjusted to check for children before serializing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions