Given xsd files, need to send XML with data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?RGF2aWQ=?=

    Given xsd files, need to send XML with data

    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.ReadXml Schema() but get the
    error:

    System.InvalidO perationExcepti on: 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"
    elementFormDefa ult="qualified"
    attributeFormDe fault="unqualif ied">

    <xs:import namespace="DCLG-HIP" schemaLocation= "Test.xsd"/>

    <xs:element name="Inspector Request">
    <xs:complexType >
    <xs:sequence>
    <xs:element name="Inspector " type="HIP:Inspe ctor" minOccurs="0"
    maxOccurs="unbo unded"/>
    <xs:element name="Address" type="HIP:Addre ssType" />
    </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"
    elementFormDefa ult="qualified" >

    <xs:include schemaLocation= "MyElements.xsd " />

    <xs:element name="Inspector " type="HIP:Inspe ctor" />
    <xs:element name="AddressTy pe" type="HIP:Addre ssType" />

    </xs:schema>


  • =?Utf-8?B?RGF2aWQ=?=

    #2
    RE: Given xsd files, need to send XML with data

    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"
    elementFormDefa ult="qualified" >

    <xs:complexTy pe name="Inspector ">
    <xs:all>
    <xs:element name="Contact-Address" type="AddressTy pe" />
    </xs:all>
    </xs:complexType>

    <xs:complexTy pe name="AddressTy pe">
    <xs:all>
    <xs:element name="Town" type="xs:string " minOccurs="0"/>
    </xs:all>
    </xs:complexType>

    <xs:element name="Inspector " type="HIP:Inspe ctor" />
    <xs:element name="AddressTy pe" type="HIP:Addre ssType" />

    </xs:schema>


    "David" wrote:
    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.ReadXml Schema() but get the
    error:
    >
    System.InvalidO perationExcepti on: 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"
    elementFormDefa ult="qualified"
    attributeFormDe fault="unqualif ied">
    >
    <xs:import namespace="DCLG-HIP" schemaLocation= "Test.xsd"/>
    >
    <xs:element name="Inspector Request">
    <xs:complexType >
    <xs:sequence>
    <xs:element name="Inspector " type="HIP:Inspe ctor" minOccurs="0"
    maxOccurs="unbo unded"/>
    <xs:element name="Address" type="HIP:Addre ssType" />
    </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"
    elementFormDefa ult="qualified" >
    >
    <xs:include schemaLocation= "MyElements.xsd " />
    >
    <xs:element name="Inspector " type="HIP:Inspe ctor" />
    <xs:element name="AddressTy pe" type="HIP:Addre ssType" />
    >
    </xs:schema>
    >
    >

    Comment

    Working...