XmlConvert.VerifyTOKEN Method (String)

 

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

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

public static string VerifyTOKEN(
	string token
)

Parameters

token
Type: System.String

The string value you wish to verify.

Return Value

Type: System.String

The token, if it is a valid token.

Exception Condition
XmlException

The string value is not a valid token.

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

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

For more information on tokens, see http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#token.

.NET Framework
Available since 2.0
Return to top
Show: