XmlConvert.VerifyTOKEN(String) 方法
定义
根据 W3C XML 架构第 2 部分“数据类型”建议,验证该字符串是否为有效标记。Verifies that the string is a valid token according to the W3C XML Schema Part2: Datatypes recommendation.
public:
static System::String ^ VerifyTOKEN(System::String ^ token);
public static string? VerifyTOKEN (string? token);
public static string VerifyTOKEN (string token);
static member VerifyTOKEN : string -> string
Public Shared Function VerifyTOKEN (token As String) As String
参数
- token
- String
要验证的字符串值。The string value you wish to verify.
返回
标记(如果它是有效的标记)。The token, if it is a valid token.
例外
该属性值不是有效的标记。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");
}
有关标记的详细信息,请参阅 NMTOKEN。For more information on tokens, see NMTOKEN.