You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's possible to eliminate the Name/OwnedName, Attribute/OwnedAttribute, reader::XmlEvent/writer::XmlEvent, etc, dualities by switching their fields to use Cow everywhere, and then replacing reader::XmlEvent with writer::XmlEvent (and adding a few more Cows).
It also seems (to me) that the result would be more elegant, and easier to work with in downstream code, but I understand that I may be missing something.
The text was updated successfully, but these errors were encountered:
Also, I've just discovered that, apparently, a new copy of Namespace is passed into each reader::XmlEvent::StartElement and that seems very bothersome to me, and easily solvable with Cow.
I thought about doing so initially, but I'm not really sure if it actually will be convenient. Also, it probably wasn't possible way back when I started writing the library. Maybe something has changed, and it is possible and convenient to do now; this probably should be investigated.
As for your second observation, I'm afraid it is not that simple. If you do not want to pass a separate instance of Namespace into each event, then you need to pass a borrow of one. Where the owned version of the namespace should be stored then? It cannot be stored in the reader and shared between multiple events, because each event may potentially have different namespace configurations. The only way to make it consistent is to put a new instance of Namespaces into each event, just like with names and other properties.
If you want, you may try to change the API to be Cow-based and send a PR. If it works out and provides more convenience than the separate event enums, I would certainly be willing to merge it.
I think it's possible to eliminate the Name/OwnedName, Attribute/OwnedAttribute, reader::XmlEvent/writer::XmlEvent, etc, dualities by switching their fields to use Cow everywhere, and then replacing reader::XmlEvent with writer::XmlEvent (and adding a few more Cows).
It also seems (to me) that the result would be more elegant, and easier to work with in downstream code, but I understand that I may be missing something.
The text was updated successfully, but these errors were encountered: