On Tue, 30 Dec 2003 16:16:42 -0500, in dotnet you wrote: >Hello, > >I was just playing around with XML serialization and noticed that I >couldn't map a schema nonNegativeInteger type to an int32 field in my .NET >type. Sure enough, the docs show that nonNegativeInteger, >nonPositiveInteger, positiveInteger, negativeInteger, and a few >other "whole number" types are mapped to System.String. > >Does anyone know the rationale for this? Is there a way to tell the >default serializer to allow this (I guess I could just remove the >attribute's DataType property): > >[System.Xml.Serialization.XmlElementAttribute >(DataType="nonNegativeInteger", IsNullable=true)] >public int PurchaseLeadTime; > >Thanks, > >- EJ
I imagine they're mapped to string because they have unbounded sizes, i.e. postiveInteger is any postive integer there is no limit on how large a number it can contain. xsd:int is a 32 bit integer that can be mapped to Int32. Cheers Simon www.pocketsoap.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com