Hi Christopher,

Christopher Hunt <[EMAIL PROTECTED]> wrote on 06/09/2008 07:43:20 AM:

> Hi there,
>
> I'm not sure if this is an Xerces issue so forgive me if it is not.
>
> I believe that an abstract element with and xsi:type of a concrete
> class should mean that the element is concrete. Unfortunately I am
> getting a validator message that contradicts this.

You're confusing abstract elements with abstract types. An element
appearing in instance cannot be abstract [1]. Specifying xsi:type has no
effect on that. To form a valid instance you would need to substitute the
abstract element with a member of its substitution group [2].

> I've produced an XML (GML) document which I validate with Java 1.5's
> SchemaFactory for a junit test case. The test case fails and declares:
>
>  The value of {abstract} in the element declaration for 'ns1:
> AbstractTimeSlice' must be false.
>
> Here's the xml:
>
>  <AbstractTimeSlice xsi:type="ns:JourneyStatusType" ns1:id="a1">
>
> Here are my Java details:
>
> java version "1.5.0_13"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
> Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)
>
> I'm also running on Mac OS X (10.5.3) and from what I've read,
> Xerces is the default validator for my environment (hence the
> posting to this forum!).

Just an FYI ... What ships in Java 5 isn't exactly Xerces. It's Sun's four
year old fork off the Apache codebase which pre-dates the implementation of
SchemaFactory here. It has bugs which are unique to it and others which
have long been fixed in Apache.

> Thanks for any help and/or guidance.
>
> Cheers,
> -C

Thanks.

[1] http://www.w3.org/TR/xmlschema-1/#cvc-elt
[2] http://www.w3.org/TR/xmlschema-0/#SubsGroups

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

Reply via email to