Link to home
Start Free TrialLog in
Avatar of rnicholus
rnicholus

asked on

What is "NewDataSet" in XSD?

Hi,

I'm using a XSD generator from an XML. Below is my XML and XSD generated from the XSD generator.
I'm confused about this part in XSD:
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="MYDATA" />
      </xs:choice>
    </xs:complexType>
  </xs:element>
Can someone please advice what does the above mean?
XML:
-----------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<MYDATA>
<FEED1>2</FEED1>
<FEED2>2009-02-02T05:02:02 GMT</FEED2>
<FEED3>US/Central</FEED3>
</MYDATA>
-----------------------------------------------------------------------------------
 
XSD generated:
-----------------------------------------------------------------------------------
<?xml version="1.0"?>
<!-- Generated using Flame-Ware Solutions XML-2-XSD v2.0 at http://www.flame-ware.com/Products/XML-2-XSD/ -->
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="MYDATA">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="FEED1" type="xs:string" minOccurs="0" />
        <xs:element name="FEED2" type="xs:string" minOccurs="0" />
        <xs:element name="FEED3" type="xs:string" minOccurs="0" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="MYDATA" />
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
</xs:schema>
-----------------------------------------------------------------------------------

Open in new window

Avatar of Mick Barry
Mick Barry
Flag of Australia image

NewDataSet is the name of the element, looks like it just picked one for you.

Avatar of rnicholus
rnicholus

ASKER

objects, I don't understand....

to which element "NewDataSet" is referring to??
Its the name allocated to that xs:element.

though that doesn't match the xsd in the code box :)

objects,

the URL doesn't seem to help.

I still don't understand this part:
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="MYDATA" />
      </xs:choice>
    </xs:complexType>
  </xs:element>

ignore that, I see what ur talking about

thats the top level schema definition, basically saying your doc will contain a MYDATA element
the earier schema definition defines what a MYDATA element looks like

objects,

I thought MYDATA supposed to be the top level?
For example:

If the XML is this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<MYDATA>
<FEED1 test1="1" test2="2" test3="3" />
</MYDATA>

The XSD will be the one in the code snippet.

<?xml version="1.0"?>
<!-- Generated using Flame-Ware Solutions XML-2-XSD v2.0 at http://www.flame-ware.com/Products/XML-2-XSD/ -->
<xs:schema id="MYDATA" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="MYDATA" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="FEED1">
          <xs:complexType>
            <xs:attribute name="test1" type="xs:string" />
            <xs:attribute name="test2" type="xs:string" />
            <xs:attribute name="test3" type="xs:string" />
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

Open in new window

Any thoughts on this?
Interesting result :)
The generator seems to adding an extra level based on their being more subelements in your original example. Does the generator come with a manual.
ASKER CERTIFIED SOLUTION
Avatar of rnicholus
rnicholus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
how is .net involved?  you didn't mentiuon anything about it in original q

I ask around and someone told me that's the way .NET XSD generator works.
I didn't know it before.
isn't that pretty much what I said :)

object,

Can you please point out where you mention about .NET?
The answer: "That's how the .NET XSD generator works" explains my problem.
This is what I'm looking for in this particular question.

I don't mean to be picky .. and you've been very helpful in many of my questions .. for this I thank you.. but I just want to make sure to be fair when giving the points..:)
I didn't, as I wasn't aware you were even using .net.
I was referring to my stating that the xsd was adding extra level, there may well be other generators that do the same. Depends on how they generalise. So I'm really saying thats just how the generator works :)

I'm happy with whatever you do.