Cannot create XmlSerializer from XSD generated class object

G

Guest

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

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

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.
 
L

Ludwig

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

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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top