Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在尝试使用JAXB将Double转换为XML时,如何避免指数(科学)字符串_Xml_Jaxb_Exponential - Fatal编程技术网

在尝试使用JAXB将Double转换为XML时,如何避免指数(科学)字符串

在尝试使用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=&

我正在使用JAXB将对象转换为XML。当我在double或integer属性中给出的值超过9999999时,JXB将数字转换为指数值,如1.00001997E9。请提供适当的解决方案,以避免转换为指数数

我使用以下代码进行转换

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

您如何计算
当前金额的值
?您如何计算
当前金额的值