Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: bug within System.Xml.Serialization?

From: "Chris Lovett" <clovett@------.--------->
To: NULL
Date: 4/5/2006 12:42:00 AM

The innerException says:

-  InnerException {"'PROTOCOL-TYPE' is an invalid value for the 
XmlElementAttribute.DataType property. The property may only be specified 
for primitive types."} System.Exception {System.InvalidOperationException}

According to the documentation for DataType, it is about disambiguating the 
xsd type for primitive types only that map to CLR strings or are otherwise 
ambiguous.  It is not a way to specify CLR enums to XSD simpleType mappings.

But if you are just trying to rename the XSD type from PROTOCOL-TYPE to the 
CLR type PROTOCOLTYPEPOLICY, then use the TypeName attribute:

[System.Xml.Serialization.XmlTypeAttribute(TypeName="PROTOCOL-TYPE")]
public enum PROTOCOLTYPE {
    hugo,
    lulli,
}

And remove the DataType attribute all together.


"ankaiser" <ankaiser@d...> wrote in message 
news:16B8F083-F1A5-4546-B2FA-CC73874997B9@m......
> hello - i am just a beginner of xml,
>
> i want to produce the following xml-output:
>
> <PROTOCOL xsi:type="PROTOCOL-TYPE">hugo</PROTOCOL>
>
> with the following c#-source:
>
>    public enum PROTOCOLTYPEPOLICY
>    {
>        hugo,
>        lulli
>    }
>
>   [XmlElement(DataType = "PROTOCOLTYPEPOLICY")]
>   public PROTOCOLTYPEPOLICY PROTOCOL;
>
> why does it not work?
> 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent