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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Schema Extension and validation of an instance

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Schema Extension and validation of an instance
  • From: "Christopher Foley" <ccfoley@gmail.com>
  • Date: Tue, 18 Jul 2006 14:28:45 +0100
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=B/9q1o236x8Klcgmo35pIbH49xH4iLaEY2NCgz6UkZGe8ob7qhDCYLVCs8zjWkg0NQjNwlCma9rjbvOdXOzcDAfziHlAvPY+p+C8GJjbr0J0UmHvLmMhPYZ1X2Tke41XYHYXxzWmKxmRE0Roj2In/14h7sJYZIkAhbhaXzkBYi0=

Hi,

I want to extend an XML schema. An element exits in the base schema,
which is defined to be of a certain complexType. I want to use this
element but to extend its type. I do this with the files below but
when I validate an instance of the extended schema , I get problems.

The base schema (IPDRDoc3.5.xsd) is as follows;
=====================================

 <schema xmlns="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://www.ipdr.org/namespaces/IPDR";
xmlns:ipdr="http://www.ipdr.org/namespaces/IPDR"; version="3.5">
  <include schemaLocation="http://www.ipdr.org/public/IPDRTypes.xsd"; />
- <complexType name="IPDRType" final="restriction">
- <annotation>
  <documentation>This is the base type for the IPDR element. The
service-specific schema can extend this by deriving from
it.</documentation>
  </annotation>
- <sequence>
  <element ref="ipdr:IPDRCreationTime" minOccurs="0" />
  <element ref="ipdr:seqNum" minOccurs="0" />
  </sequence>
  </complexType>
- <element name="IPDR" type="ipdr:IPDRType">
- <annotation>
  <documentation>An IPDR describes an event between a service consumer
and a service element. Details of the event are contained within this
record. All IPDR elements have a time indicating when the event
occurred.</documentation>
  </annotation>
  </element>
  </schema>

I want to use the IPDR element but extend the IPDRType complexType.

My Extending schema(filename -> ExtendedIPDR.xsd);
=========================================

<?xml version = "1.0" encoding = "UTF-8"?>
<schema xmlns = "http://www.w3.org/2001/XMLSchema";
	targetNamespace = "http://www.mySchema.com/ccf";
	xmlns:ccf = "http://www.mySchema.com/ccf
	xmlns:ipdr = "http://www.ipdr.org/namespaces/IPDR";>

<import namespace="http://www.ipdr.org/namespaces/IPDR";
schemaLocation="http://www.ipdr.org/public/IPDRDoc3.5.xsd"; />


<complexType name="IPDRTypeExtended">
<complexContent>
<extension base="ipdr:IPDRType">
<sequence>
	<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" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>

Now I create an XML instance of my extended schema;
========================================

<?xml version="1.0"?>
<ipdr:IPDR xmlns="http://www.mySchema.com/ccf "
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xmlns:ipdr="http://www.ipdr.org/namespaces/IPDR";
	xsi:schemaLocation="http://www.mySchema.com/ccf
C:\myDownloads\myFiles\ExtendedIPDR.xsd">

	<ipdr:IPDRCreationTime>2001-0531T13:20:00.561Z</ipdr:IPDRCreationTime>
	<ipdr:seqNum>1</ipdr:seqNum>
	<transactionID>1</transactionID>
	<serviceID>1</serviceID>
	<serviceName>New</serviceName>
	<customerID>Chris</customerID>
	<sessionID>1</sessionID>
	<timeZoneOffset>12</timeZoneOffset>
</ipdr:IPDR>

Now my problem is when I validate the instance above against the
extended schema(I am using Xselerator to do my validation). The error
I'm getting is;
' The element 'transactionID' is used but not declared in the schema'.

But transactionID is defined and I even tried to prefix it with 'ccf'
xmlns:ccf="http://www.mySchema.com/ccf"; in the instance document and
it still dosen't work.

Do I need to redefine the IPDR element itself to be of type 'IPDRTypeExtended'??

Any help appreciated.

Best Regards,
Chris.




 

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

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