473,800 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ("MyElementData Table"), 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 "NormalElementD ataTable".
There will be a relation between MyElementDataTa ble and
NormalElementDa taTable. (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 NormalElementDa taTable 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"
elementFormDefa ult="qualified"
attributeFormDe fault="qualifie d"
xmlns="http://tempuri.org/Dataset1.xsd"
xmlns:mstns="ht tp://tempuri.org/Dataset1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSe t="true">
<xs:complexType >
<xs:choice maxOccurs="unbo unded">
<xs:element name="MyElement ">
<xs:complexType >
<xs:sequence>
<xs:element name="NormalEle ment" minOccurs="0" maxOccurs="10">
<xs:simpleTyp e>
<xs:restricti on 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 1272

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

Similar topics

2
2890
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 when I try to instantiate one of the strongly-typed tables from this dataset from a different assembly, I cannot. Let me provide examples... If I have a simple dataset like this:
0
1372
by: Nathan Ernst | last post by:
I have a pretty simple XSD schema: ******************************************** * XSD SCHEMA ******************************************** <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="PageHitStatistics" targetNamespace="urn:PageHitStatistics" elementFormDefault="qualified" xmlns="urn:PageHitStatistics"
0
2359
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 keys as elements it works and I get the public QuestionRow FindByorder(short order) { return ((MenuTitlesRow)(this.Rows.Find(new object {order}))); }
0
1432
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 and another which has the same keys but has an additional level of nest which produces a much smaller DataSet.cs file using command line xsd test.xml /d
2
3691
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) having an attribute defined as such: <xs:element name="Sig" nillable="true" minOccurs="0" maxOccurs="unbounded"> <xs:complexType>
0
1339
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. I have created a schema which references another schema (like a library of complex and simple types) that has a complex typed defined called 'Related files', but when I generate a typed dataset from the xsd and use the WriteXMLSchema method then...
9
3393
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 XSL builder tool in .NET. I define the dataset at the beginning the the main class: MortgageDS _MortgageDS = new MortgageDS();
0
1224
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 strCategPath
21
2435
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 with the ability to configure the connection string via a config file? The designer seems to hard-code the connection string into the dataset itself, which just can't be right.
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.