Mono Class Library: System.Xml.XmlConvert Overview | Members

System.Xml.XmlConvert.DecodeName Method

Decodes a name. [Edit]

public static string DecodeName (string name)

Parameters

name
A string specifying the name to be decoded. [Edit]

Returns

A string containing the decoded name. [Edit]

Remarks

Names are decoded using the following rules:

  • Names are decoded from left to right.
  • Any sequence _xHHHH_ (where HHHH stands for a valid, four digit hexadecimal UCS-2 code) that has not been previously decoded is transformed into the corresponding Unicode 2.1 (Unicode 3.0 if supported by the application) character.
  • No short forms are recognized. They are passed on without translation. For example, "_x70_" or "__" are not decoded.
Note:

This method does the reverse of the XmlConvert.EncodeName(string), XmlConvert.EncodeLocalName(string), and XmlConvert.EncodeNmToken(string) methods.

[Edit]

Example

The following example demonstrates the valid and invalid character formats for decoding.

C# Example
using System;
using System.Xml;

public class App {

  public static void Main() {

    Console.WriteLine( "{0} : {1} : {2}",
      // _x0069_ decodes to i
      XmlConvert.DecodeName("Order #1_x0069_"),

      // missing beginning _
      XmlConvert.DecodeName("Order #1x0069_"),

      // short form
      XmlConvert.DecodeName("Order #1_x69_") ); 
  }
}
   

The output is

Order #1i : Order #1x0069_ : Order #1_x69_

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0