xsi:type + new namespace

I have the following small XML document

<ns1:Root xmlns:xsi="http://..../XMLSchema-instance"
                 xsi:schemaLocation="http://originalschema schema.xsd"
                 xmlns:ns1="http://originalschema">
  <ns1:Element xsi:type="ExtendedElement">
     <data1>some data</data1>
     <ns2:data2 xmlns:ns2="http://www.avaya.com/schema">more 
data</ns2:data2>
  </ns1:Element>
</ns1:Root>

It is not valid.  My question is what do I need to add to make it valid?

Now for the bigger picture.  ExtendedElement is in the www.avaya.com 
namespace while Element is in the originalschema namespace.  I believe 
this is an invalid document, plus xerces 2 doesn't like this document to 
much either so I think it agrees.  It can't find the ExtendedElement 
type because it thinks it is in the originalschema namespace when it 
only exists in the www.avaya.com namespace.

As you can probably deduce, ExtendedElement is an extension of Element 
in the xsd, but is in a different namespace according to the schemas. 
 To adhere to the original schema and be compatible with it, ns1:Element 
MUST be specified so it validates correctly for those not using the 
extended schema that exists in www.avaya.com namespace.  

I guess the real question is how do you specify the namespace of an 
xsi:type attribute non-globally? If you can specify it globally, how do 
you do that also?  Is it ns2:xsi:type="ExtendedElement"???
thanks,
dean

Received on Saturday, 15 November 2003 14:17:18 UTC