Actually it's not a bug, since you can't represent the xsd:integer type semantics in a programmatic type sistem. It's specified as an unbounded "mathematical" definition of integer number, therefore it can't be compiled into a programmatic type. In xsd:integer it is possible to specify any integer number, no matter how big (or small) it is. On the other hand, xsd:int is bounded to +-2147483647(8) and can therefore be compiled to System.Int32.
And facets, well they get lost (naturally), since it is imposible to define a limitied System.Int32 (or similiar) type. Consider this: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="doc"> <xs:complexType> <xs:sequence> <xs:element name="i1" type="xs:int"/> <xs:element name="i2" type="int2"/> <xs:element name="i3" type="xs:integer"/> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="int2"> <xs:restriction base="xs:int"> <xs:minInclusive value="0"/> <xs:maxInclusive value="250"/> </xs:restriction> </xs:simpleType> </xs:schema> It goes into something like this: using System.Xml.Serialization; /// <remarks/> [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public class doc { /// <remarks/> public int i1; /// <remarks/> public int i2; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(DataType="integer")] public string i3; } At first I misspeled the type name, since it was a long time ago when I read the Part II XML Schema spec. Now, things are getting clear again. :) Regards, Matevz. On Mon, 22 Jul 2002 09:31:58 -0700, Howard Hoffman <[EMAIL PROTECTED]> wrote: >BTW - I think MS considers this an XSD.exe bug. It also affects the >xs:positiveInteger, xs:nonNegativeInteger, and related cousins. > >For that family of types, the work around is to use xs:int and then >restrict the type with minInclusive, maxInclusive, etc. facets. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
