serde-xml-rs icon indicating copy to clipboard operation
serde-xml-rs copied to clipboard

Serializing should use the XML library instead of printing strings

Open Michael-F-Bryan opened this issue 7 years ago • 3 comments

When I initially wrote the Serializer I was just using write!() to write the XML as a string to an internal io::Writer.

Ideally we should be using the xml-rs library instead so can guarantee the generated XML is syntactically correct, plus we'd get things like pretty-printing for free.

Michael-F-Bryan avatar Aug 24 '17 09:08 Michael-F-Bryan

@oli-obk, any chance you can add the "Refactor" label to this?

Michael-F-Bryan avatar Aug 24 '17 09:08 Michael-F-Bryan

I could start working on it.

farodin91 avatar Aug 24 '17 09:08 farodin91

You may want to hang out until we merge #36. I've gone through and added support for serializing all the serde data types, so we'd end up stepping on each others toes and have annoying merge conflicts.

After that you can just go through and swap out write!() statements with pushing an XML event to a xml_rs::EventWriter. It shouldn't be overly difficult because all the structure is there, we just need to swap out where things get written to.

Michael-F-Bryan avatar Aug 24 '17 10:08 Michael-F-Bryan