Mapping Atomic Types to CLR Types

Overview

This document explains the CLR types that are used to represent XDM values in XmlPrime.

These are the types that can be used for the arguments and return types of XDM functions implemented in C# classes. See Native modules for more information.

These are also the types that are used in the TypedValueTypedValueTypedValue and ValueTypeValueTypeValueType properties on the XPathAtomicValueXPathAtomicValueXPathAtomicValue class.

The types exposed for atomic values in XmlPrime differ from those used in the System.XmlSystem.XmlSystem.Xml namespace. In some places we have used different types because the types used in the System.XmlSystem.XmlSystem.Xml namespace do not fully represent the value (for example the lack of time zones in the date and time types).

 
 
Note
This document does not apply to the values returned from the XPathNavigator.TypedValueXPathNavigator.TypedValueXPathNavigator::TypedValue property. This is because the value for XPathNavigatorXPathNavigatorXPathNavigator instances is computed from the schema type by the System.Xml.SchemaSystem.Xml.SchemaSystem.Xml.Schema classes. The types of the values on XPathNavigatorXPathNavigatorXPathNavigator instances is defined by Mapping XML Data Types to CLR Types.
 

Type Mappings

In some cases more than one XDM type has the same corresponding CLR type (for example both xs:integer and xs:decimal are represented by decimalDecimaldecimal. When declaring a native function with a specified CLR type as an argument type or return type, the XDM type listed in bold will be used.

Unless otherwise annotated the use of the type byteBytebyte[] will be interpreted as a list of xs:byte values. In order to recieve or return xs:base64Binary or xs:hexBinary values the XdmTypeAttributeXdmTypeAttributeXdmTypeAttribute must be used.

XDM TypeCLR Type (used in XPathAtomicValueXPathAtomicValueXPathAtomicValue)
xs:anyURI stringStringString
xs:base64Binary byteBytebyte[]
xs:bolean boolBooleanbool
xs:byte sbyteSBytesbyte
xs:date XmlPrime.DateWithZoneXmlPrime.DateWithZoneXmlPrime::DateWithZone
xs:dateTime XmlPrime.DateWithZoneXmlPrime.DateWithZoneXmlPrime::DateWithZone
xs:decimal decimalDecimaldecimal
xs:dayTimeDuration XmlPrime.DayTimeDurationXmlPrime.DayTimeDurationXmlPrime::DayTimeDuration
xs:double doubleDoubledouble
xs:duration XmlPrime.DurationXmlPrime.DurationXmlPrime::Duration
xs:ENTITY stringStringString
xs:float floatSinglefloat
xs:gDay XmlPrime.GDayXmlPrime.GDayXmlPrime::GDay
xs:gMonth XmlPrime.GMonthXmlPrime.GMonthXmlPrime::GMonth
xs:gMonthDay XmlPrime.GMonthDayXmlPrime.GMonthDayXmlPrime::GMonthDay
xs:gYear XmlPrime.GYearXmlPrime.GYearXmlPrime::GYear
xs:gYearMonth XmlPrime.GYearMonthXmlPrime.GYearMonthXmlPrime::GYearMonth
xs:hexBinary byteBytebyte[]
xs:ID stringStringString
xs:IDREF stringStringString
xs:int intIntegerint
xs:integer decimalDecimaldecimal
xs:language stringStringString
xs:long longLonglong
xs:Name stringStringString
xs:NCName stringStringString
xs:negativeInteger decimalDecimaldecimal
xs:NMTOKEN stringStringString
xs:nonNegativeInteger decimalDecimaldecimal
xs:nonPositiveInteger decimalDecimaldecimal
xs:normalizedString stringStringString
xs:NOTATION XmlPrime.QNameXmlPrime.QNameXmlPrime::QName
xs:positiveInteger decimalDecimaldecimal
xs:QName XmlPrime.QNameXmlPrime.QNameXmlPrime::QName
xs:short shortShortshort
xs:string stringStringString
xs:time XmlPrime.TimeWithZoneXmlPrime.TimeWithZoneXmlPrime::TimeWithZone
xs:token stringStringString
xs:unsignedByte byteBytebyte
xs:unsignedInt uintUIntegeruint
xs:unsignedLong ulongULongulong
xs:unsignedShort ushortUShortushort
xs:untypedAtomic stringStringString
xs:yearMonthDuration XmlPrime.YearMonthDurationXmlPrime.YearMonthDurationXmlPrime::YearMonthDuration