I met a problem when JAXB unmarshalling xml data.
JAXB throws exception when unmarshalling empty value for int, double or date attribute from xml. For example, it throws java.lang.NumberFormatException when it unmarshals the following xml data.
<sku displayName="iphone" price=""/>
The following is my schema.
<?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 "left angle" sign in input. Can anyone help me out?
Thanks a lot.