Hi,
   Perhaps you are using the wrong prefix for the "type" element?  In my
(valid) XML Schema, I do not define a prefix for the type attribute, and
instead have the default namespace as http://www.w3.org/2001/XMLSchema.
 Perhaps that's the difference?
   Eclipse also seems to come bundled with an XML Schema validator.  That
gave me a lot of (painfully cryptic, but correct) error messages when I
tried to define my own schema.

Good luck!
Mike


On Wed, Jul 16, 2014 at 1:15 PM, jgagnon <joseph.gag...@ll.mit.edu> wrote:

> I have written an application that generates XML files that represent test
> cases for a collection of types defined by an XML schema.  Some of these
> types contain elements that are abstract.  The logic locates all concrete
> implementers of the abstract type and when an instance is generated,
> processes one of the concrete types in place of the abstract type.
>
> It's my understanding that the element must have a type reference attribute
> that indicates the concrete type name.  So, as an example:
>
> ...
>   <SomeElement xsi:type="ConcreteType">
>     ... content ...
>   </SomeElement>
> ...
>
> The schema defines the SomeElement field as being defined by an abstract
> type.  ConcreteType is one of many possible concrete implementers of that
> abstract type.
>
> To take this a little further, a namespace entry is made in the document
> that defines a prefix for the schema types.  So, in the root element there
> would be entry like:
>
> <Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:myPrefix="http://my-schema-site"/>
>
> The prefix is applied to all elements that are defined by the schema.  E.g.
> <myPrefix:SomeElement>.  I would also assume that the prefix needs to be
> used in the concrete type reference. So, what I have above now becomes:
>
> ...
>   <SomeElement xsi:type="myPrefix:ConcreteType">
>     ... content ...
>   </SomeElement>
> ...
>
> My application does all of this.
>
> I have also added the option to validate the instance once it's been
> generated.  *Here is where the problem enters the story.*  For some reason,
> it fails validation with the complaint:
>
> error: cvc-elt.4.2: Invalid xsi:type qname: 'myPrefix:ConcreteType' in
> element SomeElement@my-schema-site
>
> Oddly, if I validate the instance externally using XMLBeans validate
> utility
> (.../xmlbeans-2.6.0/bin/validate), there is no complaint.
>
> Am I doing something wrong?
>
>
>
>
> --
> View this message in context:
> http://xmlbeans.996285.n3.nabble.com/Validation-issues-tp7520.html
> Sent from the XMLBeans User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
> For additional commands, e-mail: user-h...@xmlbeans.apache.org
>
>

Reply via email to