[xsd-users] Preserving element order with groups when writing XML

Boris Kolpackov boris at codesynthesis.com
Tue Jun 7 07:30:55 EDT 2011


Hi Jiri,

Jiri Krutil <jiri at krutil.com> writes:

> I have complexTypes representing binary and ternary operators, which may 
> have different operands. The order of operands matters. Both operator and 
> operand types are defined using xsd:group.
>
> In the old thread I mentioned, Boris describes a workaround involving  
> DOM association, which allows to read such XML in order.
>
> My question is: is there a similar workaround for *writing* such XML  
> documents? (I cannot change the schema.) Does it involve type  
> customization? Could you please point me to a piece of docs or an  
> example?

The following message in the archives provides a nice overview of the
problem and the available workarounds:

http://www.codesynthesis.com/pipermail/xsd-users/2010-March/002741.html

In the case when you need to serialize the XML, the DOM association
approach doesn't work and you have these three options:

1. Use type customization (links to further resources in the post above).

2. Change schema.

3. Use C++/Hybrid from XSD/e.

Boris



More information about the xsd-users mailing list