[xsd-users] xsd problem
Boris Kolpackov
boris at codesynthesis.com
Tue Jul 1 02:02:45 EDT 2008
Hi Paras,
PARAS BHATEJA <pbhateja123 at gmail.com> writes:
> we have to generate simple code instead of your code. i want that the
> classes generated should be simple and to the point as there are java
> classes generated through JAXB marshalling and unmarshalling
Java is different from C++ so it shouldn't be surprising that the
XML Schema mappings are different as well. For example for an
element with maxOccurs="unbounded" JAXB would return a type-less
java.util.List. This is not how it is done in C++. In XSD we return
a statically-typed container template. To make this convenient to
use we provide a typedef for this container along with accessor
and modifier functions which, on the surface, may seem more
complicated that JABX (your code will be a lot cleaner and safer
without the the type casts, though).
Overall, we tried to make the mapping as simple to use as possible
while being able to handle non-trivial, real-world schemas. We don't
have a simpler mapping for you. Therefore you have two options:
1. Look if someone else offers a mapping that satisfies your
requirements.
2. Get to understand why things are done the way they are done
in XSD. To get started, I suggest that you read through the
C++/Tree Mapping Getting Started Guide:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/
If you are in a hurry, at least read chapters 2 ("Hello World Example")
and 4 ("Working with Object Models").
Boris
More information about the xsd-users
mailing list