title: JaxB Output Format?
body: <p>I'm current working on a Java code that is using JaxB to handle reading/writing of xml information. It populates a Java class which is used throughout the program. At certain points, the class is marshalled and written back into xml. I'm not having problems with this, and things are functioning as expected.</p>
  
  <p>What I am curious about is if there is a way to alter the format of how JaxB writes out floating point numbers. For instance, part of the xml schema I am using contains the following excerpt:</p>
  
  <pre><code>.
  .
  &lt;xs:element name="myObfuscatedValue"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:simpleContent&gt;
        &lt;xs:extension base="xs:double"&gt;
          &lt;xs:attrbute name="myObfuscatedValue__comment" type="comment" use="optional" /&gt;
        &lt;/xs:extension&gt;
      &lt;/xs:simpleContent&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  .
  .
  </code></pre>
  
  <p>So when I unmarshall it, 'myObfuscatedValue' basically comes in as a Double. I then have a wrapper class around the JaxB generated classes that allows the user to access/modify the variables via standard setters/getters. Marshalling back works fine as well.</p>
  
  <p>What I ALSO want to do is have JaxB write the double out in a specific number format (something similar to a DecimalFormat like "0.0000E00" . Is this possible to do easily? I have been bounced around to several different resources on how to do this, but I admit that my knowledge of xml/schemas/JaxB is not up to date. Is there a way to alter the xjc call to do this? If possible, I want to avoid changing the schema file if possible (it's used by multiple codes in different languages, and I'd have to understand if changing it would break any of those codes first).</p>
  
  <p>Any help, insight or suggestions on this matter would be greatly appreciated.</p>