You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Christoph Nölke <Ch...@scalaris.com> on 2009/11/03 18:23:52 UTC

How to get missing namespace-declaration into derived elements?

Hi folks,

I'm using XMLBeans 2.4 and encountered a validation issue because of a missing namespace definition on element level.

I defined an abstract base type "operator" in "schema.common". In that schema there is another complex type "master" which contains some elements of type "operator".
In schema "schema.coolops" I defined derivations of that abstract "operator" type using extension. "schema.coolops" of course imports "schema.common".
(Don't worry about the structure - it's just an excerpt of a complex system ;-))

For adding concrete "operator"s to "master" I coded
  Master.addNewOperator().changeType(schema.coolops.AddOperator.type)
which returns me a concrete "operator" instance.

Upto here all works fine. I can save/load the XML BUT several XML validators (except XMLBeans) claim
cvc-elt.4.2: Cannot resolve 'cops:AddOperator' to a type definition for element 'Operator'.

The XML looks like this:
<application xsi:schemaLocation="application http://example.org/application.xsd" xmlns="application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com="schema.common">
  <com:master>
    <com:operator xsi:type="cops:AddOperator" xmlns:cops="schema.coolops">
      ...
    </com:operator>
  </com:master>
</application>

If I add
  xsi:schemaLocation="schema.coolops http://example.org/schema.coolops.xsd"
to the element "com:operator" it is declared to be valid.

Any ideas/hints/... how to get this "schemaLocation" set?

Thanks a lot.
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org