Generating a Schema from a DLL or Executable

The XSD tool also knows how to generate a an XSD from compiled types in a DLL or executable file. When generating a schema, xsd makes certain assumptions about the XSD types of instance variables. For any given CLR type, xsd chooses an XSD type for the schema. Table 8-2 lists each XSD type and its corresponding common language runtime type. In the cases where more than one XSD type maps to a single CLR type, the bold one will be used.

Table 8-2. XSD-to-CLR type mappings

XSD type

CLR type

xs:hexBinary

xs:base64Binary

System.Byte[ ]

xs:Boolean

System.Boolean

xs:byte

System.SByte

xs:normalizedString

xs:ENTITY

xs:ID

xs:IDREF

xs:language

xs:Name

xs:NCName

xs:NMTOKEN

xs:NOTATION

xs:string

xs:token

System.String

xs:date

xs:gMonthDay

xs:gDay

xs:gYear

xs:gYearMonth

xs:month

xs:time

xs:timePeriod

System.DateTime

xs:decimal

xs:integer

xs:negativeInteger

xs:nonNegativeInteger

xs:nonPositiveInteger

xs:positiveInteger

System.Decimal

xs:double

System.Double

xs:ENTITIES

xs:IDREFS

xs:NMTOKENS

System.String[ ]

xs:float

System.Single

xs:int

System.Int32

xs:long

System.Int64

xs:QName

System.Xml.XmlQualifiedName

xs:short

System.Int16

xs:unsignedByte

System.Byte

xs:unsignedInt

System.UInt32

xs:unsignedLong

System.UInt64

xs:unsignedShort

System.UInt16

xs:anyURI

System.Uri ...

Get .NET & XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.