[xsd-users] Seperation of Data and serialization code
boris at codesynthesis.com
Mon Jan 28 14:19:04 EST 2008
Balasubramanyam, Shivakumar <sbalasub at qualcomm.com> writes:
> Is there anyway today that I can separate the code generation of the
> Data (representing the XSD schema) and the serialization code?
> This would mostly help the layering of the software where the software
> modules would just depend on the data and does not know how it is
> actually being serialized in the system. For example, we may move from
> XML to XDR or to Custom serialization library, but that would not
> require re-building the application software.
There is no way to do this at the moment. By serialization I assume
you mean both XML (or binary) parsing and serialization. If that's
the case, then there is one problem with supporting something like
this in the future. While it is possible to separate serialization
from the object model because it is implemented as operators and
global functions, this approach won't work for parsing because it
is implemented as constructors and global functions.
We choose to use constructors for parsing in order to make the
interface help prevent construction of invalid object models by not
providing default constructors for types with required elements or
attributes. If we used something other than constructors for parsing
the we would have had to provide default constructors for all type
since parsing would have been performed in two steps: construction
first and then parsing.
More information about the xsd-users