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

Add streaming deserialization

Open oli-obk opened this issue 8 years ago • 2 comments

I merged #32 without realizing the implications.

Now we can parse

<item name="hello" source="world.rs" />
<item name="hello" source="world.rs" />

as a sequence, even though it is malformed XML.

On the other hand, serde-json has a way to deserialize objects from a stream. I think we should forbid this deserialization from working in the regular case, but add an additional way to get an iterator that produces multiple values from an input like the above.

oli-obk avatar Aug 22 '17 08:08 oli-obk

Many XML documents that occur in the real world have multiple root elements (e.g. the ones I have to deal with at work) so I'd appreciate if I could still parse those documents (even though they don't adhere to the standard). Maybe it would make sense to treat parsing and validation as separate concerns? What other ways are there that a xml document can be syntactically correct but semantically incorrect?

Boscop avatar Aug 22 '17 11:08 Boscop

I don't really have an issue with being more permissive than the standard, as long as there are no ambiguities. How does Vec<String> serialize to xml right now? With one root element containing the elements, or with multiple root elements? Roundtripping needs to work, and there need to be ways to serialize/deserialize much xml out in the wild.

oli-obk avatar Aug 22 '17 13:08 oli-obk