Export (0) Print
Expand All

XmlConvert.VerifyTOKEN Method

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.

ExceptionCondition
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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show:
© 2015 Microsoft