Cannot create XmlSerializer from XSD generated class object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Sm9obiBB?=

    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
  • Ludwig

    #2
    Re: Cannot create XmlSerializer from XSD generated class object

    On Wed, 16 May 2007 12:37:01 -0700, John A
    <i-code4food@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

    Comment

    Working...