XmlConvert.EncodeNmToken Method (String)

 

Verifies the name is valid according to the XML specification.

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

public static string EncodeNmToken(
	string name
)

Parameters

name
Type: System.String

The name to be encoded.

Return Value

Type: System.String

The encoded name.

This method guarantees that the name is valid according to the XML specification. For example, if you passed this method the invalid name 70+, it returns 70_x002b_ which is a valid XML name.

If name is null or String.Empty then you get the same value returned.

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: