OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Schema Extension and validation of an instance

[ Lists Home | Date Index | Thread Index ]


Thanks to all for the info. The redefinition of the IPDR element works fine.

But I am getting some difficulty when using the xsi:type alternative;

My new complex type is as follows(newComplexType.xsd);
<?xml version = "1.0" encoding = "UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema";

<import namespace="http://www.mySchema.com/ccf"; schemaLocation="ccf.xsd"/>

<complexType name="IPDRTypeExtended">
<extension base="ipdr:IPDRType">
       <element name="ccf:transactionID" type="string" minOccurs="0"/>
       <element name="ccf:serviceID" type="string" minOccurs="0" />
       <element name="ccf:serviceName" type="string" minOccurs="0" />
       <element name="ccf:customerID" type="string" minOccurs="0" />
       <element name="ccf:sessionID" type="string" minOccurs="0" />
       <element name="ccf:timeZoneOffset" type="string" minOccurs="0" />

I don't redefine the IPDR element, I just use the xsi:type method in
the instance document as follows;
<?xml version="1.0"?>
<ipdr:IPDR xmlns="http://www.mySchema.com/ccf";
  ccf.xsd http://www.ipdr.org/namespaces/IPDR newComplexType.xsd"


On validating this instance, it tells me that

'Type {http://www.ipdr.org/namespaces/IPDR}IPDRTypeExtended is not
found in schema.'

This is coming from -> xsi:type="ipdr:IPDRTypeExtended"

But it is defined in the schema(newComplexType.xsd). And it is also
part of the http://www.ipdr.org/namespaces/IPDR namespace. I have
looked at the specs for sample uses of xsi:type and what I'm doing
looks correct, I think!!!

I am somewhat confused as to why it is not validating(using Xselerator
to do the validation).

Any pointers??

Best Regards,
On 7/18/06, Michael Kay <mike@saxonica.com> wrote:
> > Do I need to redefine the IPDR element itself to be of type
> > 'IPDRTypeExtended'??
> Yes. You've defined an extended type, but the element declaration still
> refers to the original type. You can create an instance that conforms to the
> extended type by giving it an xsi:type attribute.
> Michael Kay
> http://www.saxonica.com/


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS