Mono Class Library: System.Xml NamespaceSystem.Xml.XmlConvert Class |
See Also: XmlConvert Members
|
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
Element and attribute names or ID values are limited to a range of XML characters according to the Extensible Markup Language (XML) 1.0 (Second Edition) recommendation, located at www.w3.org/TR/2000/REC-xml-20001006.html. When names contain invalid characters, they need to be translated into valid XML names.
Many languages and applications allow Unicode characters in their names, which are not valid in XML names. For example, if 'Order Detail' were a column heading in a database, the database allows the space between the words Order and Detail. However, in XML, the space between Order and Detail is considered an invalid XML character. Thus, the space, the invalid character, needs to be converted into an escaped hexadecimal encoding and can be decoded later.
The XmlConvert.EncodeName(string) and XmlConvert.DecodeName(string) methods are used to translate invalid XML names into valid XML names and vice versa.
System.Xml.XmlConvert provides methods that enable the conversion of a string to a CLI data type and vice-versa. Locale settings are not taken into account during data conversion.
System.Xml.XmlConvert also provides methods that convert between XML Schema Definition (XSD) data types (see http://www.w3.org/TR/xmlschema-2/#built-in-datatypes) and their corresponding common language infrastructure (CLI) data types. The following table shows the XSD data types and their corresponding CLI data types.
[Edit]
XSD data type CLI data type hexBinary A byte array base64Binary A byte array Boolean bool Byte sbyte normalizedString string Date DateTime duration TimeSpan dateTime DateTime decimal decimal Double double ENTITIES A string array ENTITY string Float float gMonthDay DateTime gDay DateTime gYear DateTime gYearMonth DateTime ID string IDREF string IDREFS A string array int int integer decimal language string long long month DateTime Name string NCName string negativeInteger decimal NMTOKEN string NMTOKENS A string array nonNegativeInteger decimal nonPositiveInteger decimal NOTATION string positiveInteger decimal short short string string time DateTime timePeriod DateTime token string unsignedByte byte unsignedInt uint unsignedLong ulong unsignedShort ushort anyURI Uri
Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0