[serialization] XML archive limitations?
Hello, I would like to know if it is possible to use the serialization lib and the XML archive to serialize into XML attributes instead of XML elements. For example I want to be able to generate something like: <song id="5" title="foo"/> I would also like to know if the order of XML elements is strict. Meaning, if I have the XML: <song> <id>5</id> <name>foo</name> </song> Can I ask the library to de-serialize "name" and then "id"? What if the xml contains extra XML elements that I don't care to de-serialize? Will I get an error processing the archive? If these things are not supported right now, what would it take to support it? New xml archive? Thanks a lot, Delfin Rojas
what you ask for is not possible with the current xml_?archive classes. I believe what you want could be achieved
by writing your own version of xml_archive.
Robert Ramey
"Delfin Rojas"
Hi Delfin,
You may want to consider using C++ binding for XML, e.g.,
http://codesynthesis.com/products/xsd/
It can fulfil all of your requirements, see below.
"Delfin Rojas"
I would like to know if it is possible to use the serialization lib and the XML archive to serialize into XML attributes instead of XML elements. For example I want to be able to generate something like:
<song id="5" title="foo"/>
You can specify this in XML Schema.
I would also like to know if the order of XML elements is strict. Meaning, if I have the XML:
<song> <id>5</id> <name>foo</name> </song>
Can I ask the library to de-serialize "name" and then "id"?
XML Schema allows you to specify whether ordering is important or not.
What if the xml contains extra XML elements that I don't care to de-serialize? Will I get an error processing the archive?
With C++ binding for XML, you can disable validation and the resulting code will ignore elements/attributes it does not know about. hth, -boris
participants (3)
-
Boris Kolpackov
-
Delfin Rojas
-
Robert Ramey