473,804 Members | 3,019 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"The 'maxoccurs' attribute is not supported in this context"

Hi,

I'm trying to load some XML into a dataset with C# but I have an issue with
the schema. I'm using exactly the same code to successfully load other XML.

The only difference is in the XML I'm trying to load it has:

xs:choice maxoccurs="unbo unded"

The error message I'm getting is: "The 'maxoccurs' attribute is not
supported in this context"

The code I'm using to load the DataSet is:

WebRequest request = WebRequest.Crea te(SchemaURL);
request.Proxy = new WebProxy(proxyS erver);
request.Proxy.C redentials = credentials;
HttpWebResponse response = (HttpWebRespons e)request.GetRe sponse();
Stream dataStream = response.GetRes ponseStream();
ds.ReadXmlSchem a(dataStream);

.....and it's aborting on the ReadXMLSchema.

Any ideas what I'm doing wrong?

Many thanks

Jan 18 '08 #1
2 4293


"Andy C" <An***@discussi ons.microsoft.c omwrote in message
news:31******** *************** ***********@mic rosoft.com...
Hi,

I'm trying to load some XML into a dataset with C# but I have an issue
with
the schema. I'm using exactly the same code to successfully load other
XML.

The only difference is in the XML I'm trying to load it has:

xs:choice maxoccurs="unbo unded"

The error message I'm getting is: "The 'maxoccurs' attribute is not
supported in this context"

The code I'm using to load the DataSet is:

WebRequest request = WebRequest.Crea te(SchemaURL);
request.Proxy = new WebProxy(proxyS erver);
request.Proxy.C redentials = credentials;
HttpWebResponse response = (HttpWebRespons e)request.GetRe sponse();
Stream dataStream = response.GetRes ponseStream();
ds.ReadXmlSchem a(dataStream);

....and it's aborting on the ReadXMLSchema.

Any ideas what I'm doing wrong?

Many thanks


It should be maxOccurs with an uppercase O.

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

Jan 18 '08 #2
That was indeed the problem - cheers!

"Joe Fawcett" wrote:
>

"Andy C" <An***@discussi ons.microsoft.c omwrote in message
news:31******** *************** ***********@mic rosoft.com...
Hi,

I'm trying to load some XML into a dataset with C# but I have an issue
with
the schema. I'm using exactly the same code to successfully load other
XML.

The only difference is in the XML I'm trying to load it has:

xs:choice maxoccurs="unbo unded"

The error message I'm getting is: "The 'maxoccurs' attribute is not
supported in this context"

The code I'm using to load the DataSet is:

WebRequest request = WebRequest.Crea te(SchemaURL);
request.Proxy = new WebProxy(proxyS erver);
request.Proxy.C redentials = credentials;
HttpWebResponse response = (HttpWebRespons e)request.GetRe sponse();
Stream dataStream = response.GetRes ponseStream();
ds.ReadXmlSchem a(dataStream);

....and it's aborting on the ReadXMLSchema.

Any ideas what I'm doing wrong?

Many thanks

It should be maxOccurs with an uppercase O.

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name
Jan 19 '08 #3

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

Similar topics

52
4207
by: Markus Elfring | last post by:
How much are you interested that the attribute "style" will offer the same or similar capabilities like they are provided by the element "style" in the element "head"? Do you want that the document "Syntax of CSS rules in HTML's "style" attribute" (http://www.w3.org/TR/css-style-attr) will become an official recommendation in the near future? Best regards, Markus Elfring
24
3535
by: Charles Crume | last post by:
Hello; My "index.htm" page has 3 frames (content, navigation bar, and logo). I set the "SRC" of the "logo" frame to a blank gif image and then want to change it's contents after the other two frames have been loaded by using a javascript statement from the "navigation" frame, as shown below: top.window.ccs_logo.src = 'images/ccs_logo.gif'; alert(top.window.ccs_logo.src);
4
4673
by: mike | last post by:
regards: <a href="JavaScript:loadwindow(106,90);" style="font-family:Verdana;">元智Intranet</a> In HTML spec,are "href" and "style" called "attribute"?....@@ Could someone good give me the hand? @@. thank you may god be with you
6
13599
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? Thanks! Schema: <?xml version="1.0"?> <xs:schema id="ReportInfo" targetNamespace="http://tempuri.org/Reports.xsd"
28
2956
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions! PEP: 359 Title: The "make" Statement Version: $Revision: 45366 $ Last-Modified: $Date: 2006-04-13 07:36:24 -0600 (Thu, 13 Apr 2006) $
2
3139
by: mavis | last post by:
The usage of <xs:choice maxOccurs="unbounded"> When we want to define a set of elements that could be in any order and with any occurences (0-unbounded), we can use <xs:choice maxOccurs="unbounded"> But I alway think that is not a good schema definition for XML files, and it must influence the writing and reading performance of these set of elements if there are large amounts of sub-elements. We can imagine that the retrieval of any...
1
3975
by: BillAtWork | last post by:
Hi, I'm trying to validate an XML document against an XSD schema and I receive the following error: ---------- MyCode.CreateValidRequest : System.Web.Services.Protocols.SoapException : Validation error: The element 'http://xmlns.somewhere.com/something:rDetail' cannot contain text. Expected 'http://xmlns.somewhere.com/something:AList'. An error occurred at , (1, 533). ----------
1
2586
by: BillAtWork | last post by:
Hi, I'm trying to validate an XML document against an XSD schema and I receive the following error: ---------- MyCode.CreateValidRequest : System.Web.Services.Protocols.SoapException : Validation error: The element 'http://xmlns.somewhere.com/something:rDetail' cannot contain text. Expected 'http://xmlns.somewhere.com/something:AList'. An error occurred at , (1, 533). ----------
2
4161
by: psokulski | last post by:
I have problem with passing parameters for web service. Address for WSDL 'http://www.odfl.com/RateWeb/wsdl/com/odfl/ws/ rateestimate/RateEstimate.wsdl'. Im trying to call calculateRate in wsdl there are three elements with maxOccurs="unbunded" when i'm trying to pass them as array i receive error "org.xml.sax.SAXException: WSWS3084E: Error: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying...
0
9575
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
10320
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6846
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
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
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
3
2981
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.