Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating Dataset from Xml

Creating Dataset from Xml

Scheduled Pinned Locked Moved C#
helpxmldatabasecomquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fayu
    wrote on last edited by
    #1

    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>

    E F 2 Replies Last reply
    0
    • F Fayu

      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>

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • F Fayu

        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>

        F Offline
        F Offline
        Fayu
        wrote on last edited by
        #3

        I ended up using xsd.exe, which worked. Go figure.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups