Re: [Boost-users] [serialization] Skipping unexpected elements in XMLarchive

Peter wrote:
The additional need I'm trying to solve is that the XML elements can be reordered, i.e. come in a different order than the serialization lib expects them.
You could store whatever XML elements you skip. Then, every time you get a request to read something, first check the stored XML. You would need to have a stack of storage locations to correspond to how deep you are in the XML hierarchy and discard the XML elements on the top of the stack when you parse an end tag. I think that would work, as long as you don't mind having to buffer some XML. Another approach would be to store pointers to the variables that are passed into the serialization library, rather than storing the XML. Then, when reading an XML open tag, look in your set of stored pointers for a match and deserialize into it. I'm not sure whether or not this could be made to work with the current Serialization library. Basically, to support reordering, you need to buffer one side or the other. Buffering the XML would probably work better with the current Serialization library, but would be less efficient. HTH, Todd Greer <tgreer <at> affinegy dot com> Senior Software Developer, Affinegy LLC
participants (1)
-
Todd Greer