473,382 Members | 1,447 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,382 software developers and data experts.

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.hermes.PaginationPageQu estionTriggerRule[]' to
'mamc.regional.informatics.hermes.PaginationPageQu estionTriggerRule'

Cannot implicitly convert type
'mamc.regional.informatics.hermes.PaginationPageQu estionTriggerRule' to
'mamc.regional.informatics.hermes.PaginationPageQu estionTriggerRule[]'

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 2077
On Wed, 16 May 2007 12:37:01 -0700, John A
<i-*********@newsgroups.nospamwrote:
>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.hermes.PaginationPageQ uestionTriggerRule[]' to
'mamc.regional.informatics.hermes.PaginationPageQ uestionTriggerRule'

Cannot implicitly convert type
'mamc.regional.informatics.hermes.PaginationPageQ uestionTriggerRule' to
'mamc.regional.informatics.hermes.PaginationPageQ uestionTriggerRule[]'

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 PaginationPageQuestionTriggerRule, and look at the attribute above
it -it should be of type PaginationPageQuestionTriggerRule[], not
PaginationPageQuestionTriggerRule 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
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...
5
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...
4
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...
16
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?...
1
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...
10
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...
2
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>...
0
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...
9
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.