Ricardo Brito Da Rocha wrote:
* Enumerations
There seems to be no proper mapping made for Simple Types with xsd:enumeration
restrictions. All i get is a basic get/set method
that retrieves and takes a string, respectively.
The JAXB specification requests, that by default
a) only the nmtoken type should be mapped to an enumeration
classes and
b) only for globally declared simple types.
To override a), you need to use the attribute
jaxb:globalBindings/@typesafeEnumBase. See src/test/jaxb/enumeration.xsd
for an example. That switch works globally, for all globally declared
simple types.
To override b), you'll add a jaxb:typesafeEnumClass element to the
simple type in question. See the same file for an example. However, this
switch works only for that particular simple type.
* URIs
Defining an element of type 'xsd:anyURI' leaves me with a string, again. I was
expecting to end up with a java.net.URL, so that it
would be automatically validated (as i go from java to XML, not the opposite).
Not all URI's can be mapped to URL's. However, you can do that for
yourself using the jaxb:globalBindings/jaxb:javaType customization. See
src/test/jaxb/xjcSerializable.xsd for an example.
* Arrays
I'm defining Array like structures using unbounded elements. Two issues here:
The first is that i get a java.util.List, instead of a
proper strong-typed array of the object type. The second is that the interface
only exposes a get method, no set. I've looked and
played a bit with the way i'm generating the objects and can't seem to find any
way to actual set these values.
Again, I agree that I'd prefer to have things the way you want it. But
the JAXB specification states, that arrays must be explicitly enabled,
for example by setting jaxb:globalBindings/@collectionType="indexed".
PS: One thing that may be useful to know is that i define all fields using
xsd:element inside xsd:sequence. No xsd:attribute at all.
That doesn't matter at all. :-) Atomic elements and attributes are both
easy to handle.
Jochen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]