XmlConvert.VerifyTOKEN(String) Méthode

Définition

Vérifie que la chaîne est un jeton valide conformément à la recommandation W3C XML Schema Part2 : Datatypes.

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

Paramètres

token
String

Valeur de chaîne à vérifier.

Retours

Jeton, s’il s’agit d’un jeton valide.

Exceptions

La valeur de chaîne n’est pas un jeton valide.

Remarques

Cette méthode garantit que le jeton de nom suit la syntaxe appropriée pour un jeton valide. Il peut être utilisé de la manière suivante :

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

Pour plus d’informations sur les jetons, consultez NMTOKEN.

S’applique à