Export (0) Print
Expand All

XmlConvert.VerifyNMTOKEN Method

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.

ExceptionCondition
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) {
    //Display an error 
}

For more information on the NMTOKEN data type, see XML Schema Part 2: Datatypes.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft