473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

BUG in typed dataset generation, when using maxoccurs and Simple Types??

Hi,
I've looked all over for any information about this, and either this is
a bug that I cannot find reported or I've misunderstood something.

Lets say, in the XML Designer in VS.NET 2003, you drag over an element
(call it MyElement) and add another element of type string (call it
NormalElement) as a member. If you look at the generated typed Dataset
code there should be just one table ("MyElementDataTable"), with one
column (NormalElement).

If you set maxOccurs to something greater than 1, or unbounded, then
the dataset has to contain an additional table to allow for more than 1
NormalElement in MyElement. It will call this "NormalElementDataTable".
There will be a relation between MyElementDataTable and
NormalElementDataTable. (You can see all this easier in the "preview
Dataset", which you can access when you right click on the designer
surface).

So far, so good. If, however, you try to change the type of
NormalElement to use a Simple Type, either unnamed or named, and look
at the generated dataset, the NormalElementDataTable has disappeared.
The dataset now only allows 1 NormalElement per MyElement, although I
may have specified 10 or unbounded or whatever!

If I use XSD.exe /c, then the classes generated, whether NormalElement
uses a simple type or built-in one like string, seem to be correct
(i.e. NormalElement will be an array in MyElement).

Here is an example of the schema I mean:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Dataset1"
targetNamespace="http://tempuri.org/Dataset1.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="http://tempuri.org/Dataset1.xsd"
xmlns:mstns="http://tempuri.org/Dataset1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="MyElement">
<xs:complexType>
<xs:sequence>
<xs:element name="NormalElement" minOccurs="0" maxOccurs="10">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="7" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

Can anyone confirm whether or not this is a bug, or expected behaviour
(and if so, why). Perhaps I have misunderstood the maxoccurs occurrence
attribute?

Cheers,
Pete Beech

Nov 12 '05 #1
0 1248

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: theWizK | last post by:
Hello all. I have noticed that when I generate a strongly-typed dataset from an xml schema that the DataTables that are generated have their constructors marked as internal. What this means is...
0
by: Nathan Ernst | last post by:
I have a pretty simple XSD schema: ******************************************** * XSD SCHEMA ******************************************** <?xml version="1.0" encoding="utf-8" ?> <xs:schema...
0
by: Matthew Baskey | last post by:
Hello, I am loading a DataSet from an xml file and binding it to a hierarchical datagrid. I am trying to write some keys between the elements in my xml file into the xsd file. When I write the...
0
by: magister | last post by:
Hello, Can anyone please help me to understand why when I use one XSD file to create a DataSet.cs file it gives me a much longer file with more cs code which allows Typing for all my elements...
2
by: Usha Vas | last post by:
Hi, I had posted this question in donet.framework.adonet but thought it might make more sense here, so I apologize for the duplicate post. I have an XML schema with one of the elements (Sig)...
0
by: Kurt | last post by:
Hi, (sorry if I'm cross posting - not quite sure where to put) I am basically trying to force the user of my web service to only send a valid dataset that is based on a schema I have created. ...
9
by: Steven C. | last post by:
Hello: I'm getting an error, "primary key not defined" when trying to use the FIND method on the DataTable Rows collection. I have a typed dataset called 'MortgagesDS' that I created with the...
0
by: =?Utf-8?B?T2xkbWFu?= | last post by:
I currently have a method with the following declaration: public NGApiStatus CreateItems ( NGItems items, string strBatchName, bool bCreateBatch, bool bFailifBatchExists, string...
21
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.