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
XML Prolog (according to the specification, that's all before the root element) is not considered as XML content, so it is not mapped to serde model which works only with document content.
So it is impossible to use serde to read XML declaration as you want. You should create a Reader, read the first event and if it is Event::Decl, process it (maybe you would need to skip Event::Comment and Event::Text events, although in well-formed XML documents nothing can precede the XML declaration, so if you interested only on strictly well-formed documents, expect only Event::Decl).
Unfortunately, it is not possible to get access to the internal reader of existing Deserializer or to create a Deserializer from existing Reader, so some work for parsing will be done twice. We are interested in improvements in that area.
Thank you for taking time to help me with a well detailed response. In our use-case the double serialization might be sufficient enough, though I will think if I can come up with a better approach later on. Thank you very much!
Let's say I have some xml like this:
How could I create a structure to represent the entire data structure with the prolog?
Thanks for any help!
The text was updated successfully, but these errors were encountered: