Creating Dataset from Xml
-
Hello all, I am having a problem when trying to load a dataset with xml using ReadXml or ReadXmlSchema methods. The error I get is "DataSet doesn't allow the circular reference in the ComplexType named 'EDElementType'". The xml is below. I think it is due to the fact that the complex type EDElementType contains a element named 'children' of type EDElementType which would cause a 'circular reference'. Any ideas how I can fix this? Thanks in advance. Xml:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cbe="http://www.abccorp.com/cbe" targetNamespace="http://www.abccorp.com/cbe" version="1.0.1" elementFormDefault="qualified">
<xsd:complexType name="CBEType">
xsd:sequence
<xsd:element name="edElements" type="cbe:EDElementType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="CBE" type="cbe:CBEType" /><xsd:complexType name="EDElementType">
xsd:sequence
xsd:choice
<xsd:element name="values" minOccurs="1" maxOccurs="unbounded">
xsd:simpleType
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1024"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="hexValue" type="xsd:hexBinary" minOccurs="1" maxOccurs="1" /></xsd:choice> <xsd:element name="children" type="cbe:EDElementType" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence>
</xsd:complexType>
</xsd:schema>
-
Hello all, I am having a problem when trying to load a dataset with xml using ReadXml or ReadXmlSchema methods. The error I get is "DataSet doesn't allow the circular reference in the ComplexType named 'EDElementType'". The xml is below. I think it is due to the fact that the complex type EDElementType contains a element named 'children' of type EDElementType which would cause a 'circular reference'. Any ideas how I can fix this? Thanks in advance. Xml:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cbe="http://www.abccorp.com/cbe" targetNamespace="http://www.abccorp.com/cbe" version="1.0.1" elementFormDefault="qualified">
<xsd:complexType name="CBEType">
xsd:sequence
<xsd:element name="edElements" type="cbe:EDElementType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="CBE" type="cbe:CBEType" /><xsd:complexType name="EDElementType">
xsd:sequence
xsd:choice
<xsd:element name="values" minOccurs="1" maxOccurs="unbounded">
xsd:simpleType
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1024"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="hexValue" type="xsd:hexBinary" minOccurs="1" maxOccurs="1" /></xsd:choice> <xsd:element name="children" type="cbe:EDElementType" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence>
</xsd:complexType>
</xsd:schema>
I like going the reverse direction when creating a Data Set for use with MS tools. Ie, create a data set in code using the object methods to assign types and relationships and then save the Data Set to an XML file. You will then have a sample Data Set that MS will support.
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane
-
Hello all, I am having a problem when trying to load a dataset with xml using ReadXml or ReadXmlSchema methods. The error I get is "DataSet doesn't allow the circular reference in the ComplexType named 'EDElementType'". The xml is below. I think it is due to the fact that the complex type EDElementType contains a element named 'children' of type EDElementType which would cause a 'circular reference'. Any ideas how I can fix this? Thanks in advance. Xml:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cbe="http://www.abccorp.com/cbe" targetNamespace="http://www.abccorp.com/cbe" version="1.0.1" elementFormDefault="qualified">
<xsd:complexType name="CBEType">
xsd:sequence
<xsd:element name="edElements" type="cbe:EDElementType" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="CBE" type="cbe:CBEType" /><xsd:complexType name="EDElementType">
xsd:sequence
xsd:choice
<xsd:element name="values" minOccurs="1" maxOccurs="unbounded">
xsd:simpleType
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1024"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="hexValue" type="xsd:hexBinary" minOccurs="1" maxOccurs="1" /></xsd:choice> <xsd:element name="children" type="cbe:EDElementType" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence>
</xsd:complexType>
</xsd:schema>