cxf - Empty elements for primitve datatypes forbidden in XSD -
i encountered parsing error apache cxf while processing webservice response. comes down empty element being returned:
<myvalue />
the element definition follows:
<xsd:element name="myvalue" type="xsd:float" minoccurs="0">
now i've read on cxf mailing list empty value not allowed xsd-spec:
well, there isn't workaround it's not bug. empty element not valid decimal or date type or that.
thus, should throw exception.
expecting do?
now here comes question: can find constraint in xml schema specification?
where can find constraint in xml schema specification?
http://www.w3.org/tr/xmlschema-2/#float-lexical-representation
float values have lexical representation consisting of mantissa followed, optionally, character "e" or "e", followed exponent.
...
representations exponent , mantissa must follow lexical rules integer , decimal.
...
special values positive , negative infinity , not-a-number have lexical representations inf, -inf , nan, respectively.
so xs:float
requires @ least mantissa xs:decimal
...
decimal has lexical representation consisting of finite-length sequence of decimal digits (#x30-#x39) separated period decimal indicator. optional leading sign allowed.
...and empty string not valid xs:decimal
.
if don't have value element, should try not including element, if possible. schema seems allow omitting element because minoccurs
has value 0
. other solution insert suitable replacement value, 0
or nan
.
Comments
Post a Comment