Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XmlConvert::DecodeName Method (String^)

 

Decodes a name. This method does the reverse of the EncodeName and EncodeLocalName methods.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public:
static String^ DecodeName(
	String^ name
)

Parameters

name
Type: System::String^

The name to be transformed.

Return Value

Type: System::String^

The decoded name.

The names are decoded using the following rules:

  • Names are decoded from left to right.

  • Any sequence _x HHHH_ (where HHHH stands for a valid, four digit hexadecimal UCS-2 code) that has not been decoded is transformed into the corresponding Unicode 2.1 (Unicode 3.0 if supported by the application) character.

  • No shortforms are recognized. They are passed on without translation. For example, _x20_ or __ are not decoded.

System_CAPS_noteNote

The actual encoding of the character is application-specific. For example, Order_x0020_Details becomes Order Details. Even escaped characters that are invalid in XML names will be recognized and decoded.

The following example encodes and decodes names.

#using <System.dll>
#using <System.XML.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{

   // Encode and decode a name with spaces.
   String^ name1 = XmlConvert::EncodeName( "Order Detail" );
   Console::WriteLine( "Encoded name: {0}", name1 );
   Console::WriteLine( "Decoded name: {0}", XmlConvert::DecodeName( name1 ) );

   // Encode and decode a local name.
   String^ name2 = XmlConvert::EncodeLocalName( "a:book" );
   Console::WriteLine( "Encoded local name: {0}", name2 );
   Console::WriteLine( "Decoded local name: {0}", XmlConvert::DecodeName( name2 ) );
}

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft