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

Tony McConnell amnw14545 at googlemail.com
Thu Dec 10 07:25:36 EST 2015


And xerces-c-3.1.2 suffers from the same problem. Cannot validate the
schema against valid xml. Can't use expat as using cxx-tree...


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

> 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