RE: an Schema for this xml?

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 UTC