Hi,
I have been given a set of xsd files which I need to use to generate XML
files with my data added. I am using the DataSet.ReadXmlSchema() but get the
error:
System.InvalidOperationException: Nested table 'Contact-Address' which
inherits its namespace cannot have multiple parent tables in different
namespaces.
The two questions I have are
1) Is this the best approach?
2) What generates this error?
I have reduced the xsd files to two example files:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:HIP="DCLG-HIP"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="DCLG-HIP" schemaLocation="Test.xsd"/>
<xs:element name="InspectorRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Inspector" type="HIP:Inspector" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="Address" type="HIP:AddressType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
and an element definition xsd file
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns="DCLG-HIP" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:HIP="DCLG-HIP" targetNamespace="DCLG-HIP"
elementFormDefault="qualified">
<xs:include schemaLocation="MyElements.xsd" />
<xs:element name="Inspector" type="HIP:Inspector" />
<xs:element name="AddressType" type="HIP:AddressType" />
</xs:schema>
David - 21 Feb 2008 18:03 GMT
Hi,
Sorry, the second file should be:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns="DCLG-HIP" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:HIP="DCLG-HIP" targetNamespace="DCLG-HIP"
elementFormDefault="qualified">
<xs:complexType name="Inspector">
<xs:all>
<xs:element name="Contact-Address" type="AddressType" />
</xs:all>
</xs:complexType>
<xs:complexType name="AddressType">
<xs:all>
<xs:element name="Town" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
<xs:element name="Inspector" type="HIP:Inspector" />
<xs:element name="AddressType" type="HIP:AddressType" />
</xs:schema>
> Hi,
>
[quoted text clipped - 48 lines]
>
> </xs:schema>