users@jaxb.java.net

Re: SOAP and JAXB - problems with "mustUnderstand"

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 02 May 2003 17:09:50 -0700

To me, this is more like a limitation. Just think about things like:

<!--
   the marshaller needs to find a nearest approximation
   that doesn't use '5'.

   e.g., 1.5 -> 1.4999999999999999999999999999999999
-->
<xs:attribute name="xxx">
  <xs:simpleType>
    <xs:restriction base="xs:float">
      <xs:pattern value="[.012346789]*" /> <!-- without 5 -->
    </xs:restriction>
  </xs:simpleType>
</xs:attribute>

Constraints by the pattern facet are very difficult to exploit. So in
general it's nearly impossible to somehow use that information to make
sure that the marshaling doesn't produce that value.

Think about the above case. Just writing such an algorithm is hard
enough. And you are basically asking JAXB to *generate* it.

The case you brought up might look easier, but this is a very hard
problem in general. And that's why it cannot be done.


Fortunately, by using a customization, this can be fairly easily avoided.
You just need to write your own conversion function that takes boolean
to 0 or 1, and then apply a <javaType> customization for this simple
type.

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com