This do it? (in terms of solving your problem, not fixing XMLBeans should there be a problem there)
I _hate_ BigDecimal. = Paul[1] = ________________________________ throws Exception { EMSDataSetDocument emsDoc = EMSDataSetDocument.Factory.newInstance(); EMSDataSet emsDs = emsDoc.addNewEMSDataSet(); Header hdr = emsDs.addNewHeader(); Record rec1 = hdr.addNewRecord(); E19 rec1_e19 = rec1.addNewE19(); E19010 rec1_e19010a = rec1_e19.addNewE19010(); Procedure p1 = Procedure.Factory.newInstance(); p1.setStringValue("1.1234"); rec1_e19010a.xsetE1903(p1); E19010 rec1_e19010b = rec1_e19.addNewE19010(); Procedure p2 = Procedure.Factory.newInstance(); p2.setStringValue("2.2468"); rec1_e19010b.xsetE1903(p2); System.out.println(emsDoc.toString()); } <EMSDataSet xmlns="http://www.nemsis.org"> <Header> <Record> <E19> <E19_01_0> <E19_03>1.1234</E19_03> </E19_01_0> <E19_01_0> <E19_03>2.2468</E19_03> </E19_01_0> </E19> </Record> </Header> </EMSDataSet> ________________________________ From: Paul Cooper [mailto:pcoo...@emspic.org] Sent: Monday, September 27, 2010 11:24 AM To: user@xmlbeans.apache.org Subject: RE: Error compiling schema Tim, Your understanding of the problem is correct. This is a repeatable problem. The values being logged are coming directly from the bean's getters, so the value is correct when being added to the XML. And yes, the problem always occurs at the decimal. Interestingly, it seems to happen the SECOND time the E19 element is created. I'll log the XML (it's a pretty big file, hopefully I can log sections) and see what happens. I'll also try to find another PCR with multiple E19 elements. Paul From: Tim Watts [mailto:t...@cliftonfarm.org] Sent: Saturday, September 25, 2010 10:14 PM To: user@xmlbeans.apache.org Subject: RE: Error compiling schema Not exactly sure what's happening here in terms of procedure. My guess is that AbstractXmlBuilder (superclass of XmlPrcBuilder?) is calling setters/"adders" on the target XmlBean and that XmlPcrBuilder is then calling bean.validate(). Is that right? Can you repeat the problem at will or is it still a random thing? Also, when the values are logged are they obtained using the bean's getters or are you logging the original value that the builder receives? If the latter, it might shed some light to log the values obtained from the getters as well. Just for grins & giggles, what if you logged the XML after each set/add. Might shed some light on the point at which 89.51 becomes 89. I'm also curious to know whether the truncation always occurs exactly at the decimal point? On Sat, 2010-09-25 at 23:29 -0400, Paul Cooper wrote: All, I've successfully rebuilt my library with the 2.4 version of XMLBeans, and have successfully replicated the problem with BigDecimals with that version. Here is the logging from my server: Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Created new E19010 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1901:2010-08-23 10:15:00.0 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1902:0 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1903:89.392 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1905:1 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1906:1 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1907:4500 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1908:4605 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1909:SC008406 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1910:4625 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1911:-15 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Created new E19010 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1901:2010-08-23 10:16:00.0 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1902:0 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1903:89.51 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1905:1 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1906:1 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1907:4500 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1908:4605 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1909:SC008406 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1910:4625 Sep 25 2010 20:22 | DEBUG | AbstractXmlBuilder | Added E1911:-15 Sep 25 2010 20:22 | INFO | XmlPcrBuilder | >>>>>>>>>>>>>>>>>>>>>>>> FAILED validation: 5329436 Sep 25 2010 20:22 | INFO | XmlPcrBuilder | Message: W5329436 -- union value '89' does not match any members of 'Procedure in namespace http://www.nemsis.org' Sep 25 2010 20:22 | INFO | XmlPcrBuilder | >>>>>>>>>>>>>>>>>>>>>>>> And here is the XML output. Clearly there is an issue: <E19> <E19_01_0> <E19_01>2010-08-23T17:15:00.000Z</E19_01> <E19_02>0</E19_02> <E19_03>89.392</E19_03> <E19_05>1</E19_05> <E19_06>1</E19_06> <E19_07>4500</E19_07> <E19_08>4605</E19_08> <E19_09>SC008406</E19_09> <E19_10>4625</E19_10> <E19_11>-15</E19_11> </E19_01_0> <E19_01_0> <E19_01>2010-08-23T17:16:00.000Z</E19_01> <E19_02>0</E19_02> <E19_03>89</E19_03> <E19_05>1</E19_05> <E19_06>1</E19_06> <E19_07>4500</E19_07> <E19_08>4605</E19_08> <E19_09>SC008406</E19_09> <E19_10>4625</E19_10> <E19_11>-15</E19_11> </E19_01_0> </E19> Paul