- From: Bob Schloss <rschloss@us.ibm.com>
- Date: Tue, 18 Feb 2003 15:23:31 -0500
- To: xmlschema-dev@w3.org
Dinesh,
In test.xsd, instead of writing <xs:element name="Test1_Root"/> you
would write something like <xs:element ref="t1:Test1_Root"
xmlns:t1="test1"/>.
Although test.xsd is reference an 'element' in test1.xsd, the
mechanics are similar to when a schema references a 'type definition' in a
second schema. Please read this section of the XML Schema Primer for
information:
http://www.w3.org/TR/xmlschema-0/#import
Bob
XML/XSL Transformational Systems
IBM Thomas J. Watson Research Center
Dinesh
Sankaralingam To: xmlschema-dev@w3.org
<dsankara@cook-hu cc:
rlbert.com> Subject: importing schemas
Sent by:
xmlschema-dev-req
uest@w3.org
02/18/2003 02:47
PM
Hi,
I have 2 XSDs, test.xsd and test1.xsd
test.xsd
<xs:schema targetNamespace="test" xml:ns="test1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="test1" schemaLocation="C:\Documents and
Settings\dsankara\Desktop\Include Test\test1.xsd"/>
<xs:element name="Test_Root">
<xs:annotation>
<xs:documentation>Comment describing
your root
element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="t1"
type="xs:string"/>
<xs:element name="t2"
type="xs:string"/>
<xs:element
name="Test1_Root"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
test1.xsd
<xs:schema targetNamespace="test1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="Test1_Root">
<xs:annotation>
<xs:documentation>Comment describing
your root
element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="E1"
type="xs:string"/>
<xs:element name="E2"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
My goal is to import test1.xsd into test.xsd and reference the root element
of test1.xsd so that whenever i add or remove elements in test1.xsd i don't
have to change anything in test.xsd.
For example, if i add another element called "E3" in test1.xsd i should be
able to access it without any code changes in test.xsd.
Is it possible to do it?
Thanks
Dinesh sam
dinesh@cook-hurlbert.com
Received on Tuesday, 18 February 2003 15:24:01 UTC