quick-xml icon indicating copy to clipboard operation
quick-xml copied to clipboard

Error Location similar to Serde JSON or TOML Spanned?

Open EthanJamesLew opened this issue 1 year ago • 1 comments

Hi!

First of all, thank you for your excellent work on the quick-xml project!

I'm currently working on a project where accurate error reporting would be nice. Particularly, I would like to be able to report the line and column number of any deserialization errors that occur when parsing an XML document. From what I understand, quick-xml does not support this feature directly.

However, having a similar mechanism to what serde_json and serde_toml offer, in terms of Spanned, would be great for more precise error reporting, even at the cost of some performance overheads.

Please consider this feature for future versions of quick-xml. If there is anything I can do to help (testing, design, etc.), I would be interested in contributing.

Thanks!

EthanJamesLew avatar Jul 25 '23 01:07 EthanJamesLew

I have a proposal of spans in events in my branch (some tests a failed now), but it is not yet integrated to the error type (I also have a feeling that we should rework our errors). Feel free to take over the baton if you will.

I've also prototyping a serde integration on top of this that allows me to deserialize a special type with span information given by deserializer, but that requires changes in serde.

Also, some related ideas discussed in #109.

Mingun avatar Jul 25 '23 17:07 Mingun