I ran into a problem when JAXB was undoing XML data.
JAXB throws an exception when unmarshalling a null value for an attribute int, doubleor datefrom xml. For example, it throws java.lang.NumberFormatExceptionwhen it discards the following XML data.
<sku displayName="iphone" price=""/>
Below is my diagram:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sku" type="SkuType" maxOccurs="unbounded"/>
<xs:complexType name="SkuType">
<xs:attribute name="displayName" type="xs:string" use="required"/>
<xs:attribute name="price" type="xs:double" use="required"/>
<xs:attribute name="startDate" type="xs:dateTime" use="optional"/>
<xs:attribute name="minimumOrderQty" type="xs:integer" use="optional"/>
</xs:complexType>
</xs:schema>
Sorry for the messy xml. I can’t type the “left corner” sign at the entrance. Can anyone help me out?
Many thanks.
source
share