W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2002

RE: an Schema for this xml?

From: Kriegesmann, Peter <Peter.Kriegesmann@softwareag.com>
Date: Mon, 2 Sep 2002 16:24:33 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210602372421@daemsg02.software-ag.de>
To: "'Marcos Mayorga'" <marcos.mayorga@grupotecnobit.com>, xmlschema-dev@w3.org

Hello Marcos,

I think there might be a solution, but I am not sure if it is exactly what
you want.

You can define the 2 element definitions for "myElement" in 2 different
schema files, let's say
"schema1.xsd" and "schema2.xsd", where "schema1.xsd" is your main schema
file (you use this one for  the verification of xml documents).

Then you can import "schema2.xsd" within "schema1.xsd". Now you have 2
different element definitions for an  element of the same name
("myElement"), but within 2 different target namespaces.

In your xml document you set the default namespace (xmlns="...") to the
targetNamespace of "schema1.xsd".
Now you can switch the default namespace to the targetNamespace of
"schema2.xsd" , whenever "myElement" should be validated against the
definitions of "schema2.xsd".

So your document might look like this:

<mycontainer xmlns="targetNamespace schema1.xsd">
	<myelement name="n1" a="0" b="1">
		<mynestedelement c="2"/>
	</myelement>
	<myelement name="n2" a="0" b="1">
		<mynestedelement c="2"/>
	</myelement>
	<myelement href="doc2.xml" path="mycontainer/myelement#n3"
xmlns="targetNamespace schema2.xsd"/>
</mycontainer>

Best regards,
Peter

Peter Kriegesmann
Phone	 06151-921484
Electronic Business Technologies (QE)				Fax
06151-921612
			
Software AG
http://www.softwareag.com
Uhlandstrasse 12				
D-64297 Darmstadt
mailto:Peter.Kriegesmann@softwareag.com	
Received on Monday, 2 September 2002 10:24:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT