xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgagnon <Joseph.Gag...@ll.mit.edu>
Subject Validation issues
Date Wed, 16 Jul 2014 17:15:20 GMT
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-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Mime
View raw message