[xsd-users] Re: Default values of elements that use enumerated types

Tony McConnell amnw14545 at googlemail.com
Thu Dec 10 06:37:43 EST 2015


Unfortunately, the exception seems to arise from the xerces-c parser.
Bugger.


On Thu, Dec 10, 2015 at 10:44 AM, Tony McConnell <amnw14545 at googlemail.com>
wrote:

> Hello,
>
> I'm using xsd amd64 4.0.0-1 debian package on Ubuntu 14.04 with xerces-c
> 3.1.1-5.1
>
> I'm using the following to generate code for parsing and serialising:
>
> xsdcxx cxx-tree --hxx-suffix .h --cxx-suffix .cc --reserved-name
> xml_schema=datex2api_xml_schema --generate-serialization
> --proprietary-license --generate-polymorphic --polymorphic-type-all
> --disable-warning all --extern-xml-schema datex2_common.h
> --polymorphic-plate 1 \
>            --namespace-map
> http://datex2.eu/schema/2_0RC2/2_0=datex2_0RC2_2_0
> /tmp/DATEXIISchema_2_0RC2_2_0.xsd
>
> The schema contains an enumerated type, PrecipitationType, based on
> xsd:string and an element, precipitation, that uses that type. but which
> also has a default value of 'drizzle'.
>
> '<element name="precipitation" type="PrecipitationType" default="drizzle">'
>
> When I create some XML that has '<precipitation>drizzle</precipitation>',
> xmllint and the generated parsing code are happy with it.
>
> When I create some XML that has '<precipitation></precipitation>', xmllint
> is happy, but the generated code produces an 'unexpected enumeration'
> exception.
>
> Should XSD support default element values, or is this some problem with
> the underlying xerces-c parser?
>
> Cheers
>
> Tony McConnell
>
>


More information about the xsd-users mailing list