[xsde-users] Generate aggregate that handles multiple root elements
Jonathan Haws
Jonathan.Haws at sdl.usu.edu
Sat Jan 11 17:08:26 EST 2014
Is it possible to take a schema that defines multiple valid root elements and generate an aggregate that will parse/serialize based on what it sees?
For example, if I have a schema that defines root elements A, B, and C can I generate a parser that will accept:
<A attr="1">
<B></B>
<C></C>
</A>
As well as,
<B attr="1">
<C></C>
</B>
And,
<C attr="1"></C>
And determine what the root element is for me and parse the document?
I would also like to be able to serialize and not worry about the root element and just have some routines that look something like:
Serialize(A&);
Serialize(B&);
Serialize(C&);
Serializing would be the easy part if I had to do it myself.
Does that make sense? Can XSD/e generate something like this or am I on my own to write a class that handles all that for me?
If I am on my own, what is the easiest way to determine what the root element is since I cannot simply parse it? I would rather not manually parse it using string functions if I can avoid that. I did look at the multiroot example and didn't seem to see an answer in there...
Thanks!
Jonathan
--
Jonathan R. Haws
Embedded Engineer
Space Dynamics Laboratory
(435) 713-3489
jhaws at sdl.usu.edu
More information about the xsde-users
mailing list