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::VerifyNMTOKEN Method (String^)

 

Verifies that the string is a valid NMTOKEN according to the W3C XML Schema Part2: Datatypes recommendation

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

public:
static String^ VerifyNMTOKEN(
	String^ name
)

Parameters

name
Type: System::String^

The string you wish to verify.

Return Value

Type: System::String^

The name token, if it is a valid NMTOKEN.

Exception Condition
XmlException

The string is not a valid name token.

ArgumentNullException

name is null.

This method ensures that the name token follows the proper syntax for a valid NMTOKEN. It can be used in the following manner:

try {
  writer.WriteStartElement(XmlConvert.VerifyNMTOKEN("abc"),"book");
}
catch(Exception e) {
  Console.WriteLine("error");
}

For more information on the NMTOKEN data type, see http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#NMTOKEN.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
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