473,659 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot create XmlSerializer from XSD generated class object

Hi all, I have ceated a CSharp class from an xml schema (xsd) by using the
command line tool XSD. When I attempt to create an XmlSerializer object from
the class object. I get the following two errors.

Cannot convert type
'mamc.regional. informatics.her mes.PaginationP ageQuestionTrig gerRule[]' to
'mamc.regional. informatics.her mes.PaginationP ageQuestionTrig gerRule'

Cannot implicitly convert type
'mamc.regional. informatics.her mes.PaginationP ageQuestionTrig gerRule' to
'mamc.regional. informatics.her mes.PaginationP ageQuestionTrig gerRule[]'

I am not quite sure why the XSD tool even generated a non collection, i.e.
single instance definition of the trigger rule. In the definition the
question can have 0 to unbounded instances of trigger and trigger can have 1
to unbounded instances of rule.

Any help with this is greatly appreciated.

--
Thank you,
John
May 16 '07 #1
1 2097
On Wed, 16 May 2007 12:37:01 -0700, John A
<i-*********@newsg roups.nospamwro te:
>Hi all, I have ceated a CSharp class from an xml schema (xsd) by using the
command line tool XSD. When I attempt to create an XmlSerializer object from
the class object. I get the following two errors.

Cannot convert type
'mamc.regional .informatics.he rmes.Pagination PageQuestionTri ggerRule[]' to
'mamc.regional .informatics.he rmes.Pagination PageQuestionTri ggerRule'

Cannot implicitly convert type
'mamc.regional .informatics.he rmes.Pagination PageQuestionTri ggerRule' to
'mamc.regional .informatics.he rmes.Pagination PageQuestionTri ggerRule[]'

I am not quite sure why the XSD tool even generated a non collection, i.e.
single instance definition of the trigger rule. In the definition the
question can have 0 to unbounded instances of trigger and trigger can have 1
to unbounded instances of rule.

Any help with this is greatly appreciated.
I had the exact same error today. Have a look in the generated code
for PaginationPageQ uestionTriggerR ule, and look at the attribute above
it -it should be of type PaginationPageQ uestionTriggerR ule[], not
PaginationPageQ uestionTriggerR ule as it will probably be generated. I
think this is a bug in XSD.EXE.

--
Ludwig
http://www.coders-lab.be
May 16 '07 #2

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

Similar topics

8
3561
by: Harris Boyce | last post by:
Hello, I'm trying to use the FOR XML EXPLICIT clause with SQL Server to deserialize data from my database into a strongly-typed collection object that I will use throughout my application. I initially tested my design by building a collection in code and then serializing it to/from an XML file, which worked fine. However, I have hit a brick wall trying to restore the data from SQL Server. I originally had my collection and object
5
17654
by: Paw Pedersen | last post by:
Is it possible to load a XSD and loop throw the nodes and attributes that you whant filled out, and then generate a XML instance with the trees and data that you have filled data in? And how do you do that? Regards Paw
4
15724
by: Alexis | last post by:
Hello, Is there a way of telling the XmlSerializer to ignore all namespaces when deserializing. I'm using XmlAttributeOverrides, but I have to do it for every class the OutputObject usses. Is there an "ApplyToAll" kind of feature? I also tried the defaultNamespace, but it didn't work.
16
4747
by: danielbuus | last post by:
....or, to put it perhaps more communicative, something like this: Type someObjectsType = someObject.GetType(); someObjectsType newObject = new someObjectsType(); Is this possible? If so, how? Thanks very much in advance, Daniel :)
1
2686
by: Danny | last post by:
Am trying to XML serialize a BuildEventArgs (used for msbuild stuff) object but I don't get any xml outputted! just a header.The docs say I should be able to serialize the class public abstract class BuildEventArgs : EventArgsExample:BuildErrorEventArgs test = new BuildErrorEventArgs("asdf", "a", "d", 33, 324, 45345, 111, "msg", "Help", "sender");XmlSerializer s = new XmlSerializer(typeof(BuildErrorEventArgs), "test");Stream fs = new...
10
4777
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the value for the parameter of an SqlCommand for inserting the xml document in a column of a table where the column is typed to be of the same xml schema. This all sounds simple, but SQL Server REQUIRES the timezone to be specified for date values....
2
1294
by: Gasnic | last post by:
Hi I need to create a .NET object that will be serialized into the following xml structure ( I can't change the XML schema) <Root> <Record> <Field1>data1</Field1> <Field2>data2</Field2> <Record> <Record>
0
2622
by: =?Utf-8?B?QW1hemVkc2FpbnQ=?= | last post by:
The simple constructors of XMLSerializer class caches the typed serializer once it is generated. (Probably as you know, other XMLSerializer constructors will result in a memory leak because they will generate the assembly each time instead of using the cached one) a) When an XMLSerializer is used from ASP.NET, where exactly the generated typed serializer is getting cached? What is the probability/crieteria for the object in the cache...
9
3287
by: =?Utf-8?B?ai5hLiBoYXJyaW1hbg==?= | last post by:
Hi, I have a schema that has an optional element, fieldTag4000Field. If the element is omitted from the XML request, when it is deserialized, it will be null when I check it - which is fine. What happens when the element is supplied as <fieldTag4000Field/(empty), it does not equate to null. I want to be able handle this at the deserialization level rahter than in my edits later.
0
8428
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
8341
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,...
1
8539
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
8630
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
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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...
1
2759
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
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.