在尝试使用JAXB将Double转换为XML时,如何避免指数(科学)字符串
我正在使用JAXB将对象转换为XML。当我在double或integer属性中给出的值超过9999999时,JXB将数字转换为指数值,如1.00001997E9。请提供适当的解决方案,以避免转换为指数数 我使用以下代码进行转换在尝试使用JAXB将Double转换为XML时,如何避免指数(科学)字符串,xml,jaxb,exponential,Xml,Jaxb,Exponential,我正在使用JAXB将对象转换为XML。当我在double或integer属性中给出的值超过9999999时,JXB将数字转换为指数值,如1.00001997E9。请提供适当的解决方案,以避免转换为指数数 我使用以下代码进行转换 public static String convertToXML(Object obj) { //Create JAXB Context JAXBContext jaxbContext; String xmlContent=&
public static String convertToXML(Object obj)
{
//Create JAXB Context
JAXBContext jaxbContext;
String xmlContent="";
try {
jaxbContext = JAXBContext.newInstance( obj.getClass());
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
StringWriter sw = new StringWriter();
CDATAContentHandler cDataContentHandler;
try {
cDataContentHandler = new CDATAContentHandler(sw, "UTF-8");
jaxbMarshaller.marshal(obj, cDataContentHandler);
xmlContent= sw.toString();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println( xmlContent );
} catch (JAXBException e) {
e.printStackTrace();
}
return xmlContent;
}
我要出去了
<bdgAmount><budgetHeadID>25</budgetHeadID><currAmount>1.00001997E9</currAmount><currBudgtBalAmount>0.0</currBudgtBalAmount><currCommitAmount>0.0</currCommitAmount>
251.00001997E90.00.0
您如何计算当前金额的值
?您如何计算当前金额的值
?