netvl / xml-rs

An XML library in Rust
MIT License
459 stars 110 forks source link

Restricted XmlEvent? #215

Closed masklinn closed 1 year ago

masklinn commented 2 years ago

Opening this to ask whether that's been considered (a search didn't turn up anything and discussions are not enabled): ParserConfig allows some fairly extensive customisation to the emittable XmlEvent variants, down to 6 (and up to 9, from a default of 8 if I'm reading everything right).

However currently the user still has to "deal" with the un-emittable variants.

Granted most applications will have a single loop processing the input events, but still, would a more type-heavy interface be an option?

Sadly Rust still has no polymorphic or type-based variants, so the syntactic overhead would be fairly large, but it would also be fairly simple code, just annoying to write.

kornelski commented 1 year ago

I'm not planning to have multiple XmlEvent variants. There's no good support for that in Rust.