[xsd-users] Efficient XML Interchange Format (Exi)

Paquette, Patrick PaquetP at navcanada.ca
Fri Jan 23 15:35:00 EST 2009


Boris,

[I've replied to xsd-users because I'd like to hear input on this design
decision]

> Hi Raymond,
> 
> [I've CC'ed xsd-users to my reply in case someone else is/will be
>  interested.]
> 
> Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:
> 
> > I was leaning towards EXI since it is from W3C, and should at 
> > some point be a recommendation.  I was able to find a tool for
> > .Net that says it supports it, which would simplify 
> interoperability.
> > 
> > Do you have any documentation on the mapping from XML to 
> CDR and XDR?
> > I.e. so we could implement the matching deserialization on 
> the other 
> > end?
> 
> The binary serialization is actually quite simple. The basic types
> (e.g., ints, strings, etc.) are serialized according to the data
> representation rules. For CDR, see ace-cdr-stream-*-.hxx files
> in libxsd/xsd/cxx/tree/. For XDR, see xdr-stream-*-.hxx files. I
> think there is a better chance you will find XDR implementation 
> for C# than CDR.
> 
> User-defined types a serialized like this:
> 
> 1. If there is a base, it is serialized first.
> 
> 2. Then elements are serialized in the schema order:
>   
>    a. For required elements, the element value is serialized directly.
>    
>    b. For optional elements a boolean value is serialized first
>       indicating whether the element is present, then element
>       value, if present.
> 
>    c. For sequences of elements, the number of elements is written
>       first, then each element value in order.
> 
> 3. Then attributes are serialized in the schema order (same rules
>    as 2.a and 2.b).
> 
> If polymorphism is involved, things are a bit more complicated. For
> every non-fundamental C++ type, first a boolean value is written
> indicating whether this element's dynamic type differs from its
> static type. If it does, then the dynamic type's namespace and name
> are written. Then the value is serialized.
> 
> Actually, I think it should be pretty straightforward to extend XSD 
> to automatically generate this code for C# classes. Maybe using
> partial classes or some such.
> 
> Boris
> 

Perhaps an implementation that involves performing the binary
serialization algorithm defined above as a subclass of
XmlWriter/XmlReader provided by the .NET framework, that way you don't
need to define a new language for the xsd compiler?  Don't know which
would be easier for you.  

Patrick




More information about the xsd-users mailing list