Mapping Atomic Types to CLR Types

Overview

This document explains the types that are used to represent atomic values in XmlPrime. In particular these are 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). In other cases we have used the base type to represent values, for example using decimalDecimaldecimal instances to represent xs:int instances. This may change in a future version to be more in line with the .NET types.

 
 
Note
This document only applies to atomic values, and does not apply to XPathNavigatorXPathNavigatorXPathNavigator instances. This is because the XPathNavigator.TypedValueXPathNavigator.TypedValueXPathNavigator::TypedValue property 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.
 
 
 
Note
The types below may change in future versions of XmlPrime. In particular the bindings for the subtypes of xs:integer may be changed to bring them in line with those used by the System.XmlSystem.XmlSystem.Xml classes.
 

Type Mappings

XDM TypeCLR Type (used in XPathAtomicValueXPathAtomicValueXPathAtomicValue)
xs:anyURI stringStringString
xs:base64Binary byteBytebyte[]
xs:boolean boolBooleanbool
xs:byte decimalDecimaldecimal
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 decimalDecimaldecimal
xs:integer decimalDecimaldecimal
xs:language stringStringString
xs:long decimalDecimaldecimal
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 decimalDecimaldecimal
xs:string stringStringString
xs:time XmlPrime.TimeWithZoneXmlPrime.TimeWithZoneXmlPrime::TimeWithZone
xs:token stringStringString
xs:unsignedByte decimalDecimaldecimal
xs:unsignedInt decimalDecimaldecimal
xs:unsignedLong decimalDecimaldecimal
xs:unsignedShort decimalDecimaldecimal
xs:untypedAtomic stringStringString
xs:yearMonthDuration XmlPrime.YearMonthDurationXmlPrime.YearMonthDurationXmlPrime::YearMonthDuration