dotnet xml:
Hi all,
I have the following XML file:
<Config>
<MyFoo xmlns=3D"http://MyCompany/Foo">
</MyFoo>
<MyBar xmlns=3D"http://MyCompany/Bar">
</MyBar>
</Config>
For a project specific reason, I need to keep <MyFoo> and <MyBar>
in 2 seperate namespaces.
I run XSD.exe to generate my schema. This results in the following 3=20
XSD schema files being generated.=20
(Question):=20
Is there a way to just generate a single XSD file to=20
include all the information. (i.e) Can Test.xsd include the definitions
in Test_app1.xsd and Test_app2.xsd, such that I only need to
ship a single XSD file, Any pointers would be of help ?
Test.xsd
--------
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<xs:schema id=3D"NewDataSet" xmlns=3D"" =
xmlns:xs=3D"
http://www.w3.org/2001/XMLSchema" =
xmlns:msdata=3D"urn:schemas-microsoft-com:xml-msdata" =
xmlns:app1=3D"http://MyCompany/Foo" xmlns:app2=3D"http://MyCompany/Bar">
<xs:import namespace=3D"http://MyCompany/Foo" =
schemaLocation=3D"Test_app1.xsd" />
<xs:import namespace=3D"http://MyCompany/Bar" =
schemaLocation=3D"Test_app2.xsd" />
<xs:element name=3D"Config">
<xs:complexType>
<xs:sequence>
<xs:element ref=3D"app1:MyFoo" minOccurs=3D"0" />
<xs:element ref=3D"app2:MyBar" minOccurs=3D"0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=3D"NewDataSet" msdata:IsDataSet=3D"true">
<xs:complexType>
<xs:choice maxOccurs=3D"unbounded">
<xs:element ref=3D"Config" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Test_app1.xsd
-----------------
<?xml version=3D"1.0" standalone=3D"yes"?>
<xs:schema id=3D"NewDataSet" targetNamespace=3D"http://MyCompany/Foo" =
xmlns:mstns=3D"http://MyCompany/Foo" xmlns=3D"http://MyCompany/Foo" =
xmlns:xs=3D"
http://www.w3.org/2001/XMLSchema" =
xmlns:msdata=3D"urn:schemas-microsoft-com:xml-msdata" =
attributeFormDefault=3D"qualified" elementFormDefault=3D"qualified" =
xmlns:app1=3D"http://MyCompany/Foo" xmlns:app2=3D"http://MyCompany/Bar">
<xs:import namespace=3D"http://MyCompany/Bar" =
schemaLocation=3D"Test_app2.xsd" />
<xs:element name=3D"MyFoo" type=3D"xs:string" />
</xs:schema>
Test_app2.xsd
---------------
<?xml version=3D"1.0" standalone=3D"yes"?>
<xs:schema id=3D"NewDataSet" targetNamespace=3D"http://MyCompany/Bar" =
xmlns:mstns=3D"http://MyCompany/Bar" xmlns=3D"http://MyCompany/Bar" =
xmlns:xs=3D"
http://www.w3.org/2001/XMLSchema" =
xmlns:msdata=3D"urn:schemas-microsoft-com:xml-msdata" =
attributeFormDefault=3D"qualified" elementFormDefault=3D"qualified" =
xmlns:app2=3D"http://MyCompany/Bar" xmlns:app1=3D"http://MyCompany/Foo">
<xs:import namespace=3D"http://MyCompany/Foo" =
schemaLocation=3D"Test_app1.xsd" />
<xs:element name=3D"MyBar" type=3D"xs:string" />
</xs:schema>
Thanks