I'm having problem with java unmarshaller. Whole code was built based on an xsd fedinition. There I have decimal type defined as follows:
<xs:simpleType name="KMTyp">
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="3"/>
<xs:pattern value="\d+\.\d{3}"/>
</xs:restriction>
</xs:simpleType>
for defined attribute:
<xs:attribute name="KM_OD" type="KMTyp"/>
However unmarshaller does not read this attribute correctly from xml file:
<ODCINEK KM_OD="21.000" KM_DO="21.050">
It always returns null. Code responsible for processing xml looks as follows:
AONA50 item = new AONA50();
JAXBContext context = JAXBContext.newInstance(item.getClass());
Unmarshaller unmarshaller = context.createUnmarshaller();
unmarshaller.setSchema(schema50);
Object xmlObject = item.getClass().cast(unmarshaller.unmarshal(new File(fileName)));
return (AONA50)xmlObject;
Could anyone help me please, to make this work, so correct BigDecimal values are red from xml and returned?
//edit here is AONA50 class: http://pastebin.com/WM6XfvyW