users@jaxb.java.net

Localisation and Customizing in JAXB

From: Steffen Bleul <stbleul_at_gmx.de>
Date: Mon, 03 May 2010 15:26:14 +0200

Hello,

I have a question regarding JAXB customizing with JaxbAdapters.

I have a field in my object with type Double, in my case its necessary that this Double needs to be formatted/marshalled in 3 differents formats inside the same XML.

public Double value = ...;

Double: 0.1233554233
1. Format, no commas: 0
2. Format, 3 digits after comma: 0.123
3. Format, 2 digits after comma: 0.12

The resulting xml:
<doubleFormatA>0</doubleFormatA>
<doubleFormatB>0.123</doubleFormatB>
<doubleFormatC>0.12</doubleFormatC>

Whats the best approach to do this in JAXB?

-- 
------------------------------------------------------------------
  Dipl.-Inf. Steffen Bleul
  Distributed Systems Group, University of Kassel
  Wilhelmshöher Allee 73, D-34121 Kassel, Germany
  Tel. : +49 (0)561 804 62 82
  Fax. : +49 (0)561 804 62 77
  Email: bleul_at_vs.uni-kassel.de
  Web  : http://www.vs.uni-kassel.de/~bleul/
------------------------------------------------------------------