XmlConvert.VerifyNMTOKEN(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Verifies that the string is a valid NMTOKEN according to the W3C XML Schema Part2: Datatypes recommendation.
public:
static System::String ^ VerifyNMTOKEN(System::String ^ name);
public static string VerifyNMTOKEN (string name);
static member VerifyNMTOKEN : string -> string
Public Shared Function VerifyNMTOKEN (name As String) As String
Parameters
- name
- String
The string you wish to verify.
Returns
The name token, if it is a valid NMTOKEN.
Exceptions
The string is not a valid name token.
name
is null
.
Remarks
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) {
Console.WriteLine("error");
}
For more information on the NMTOKEN data type, see the NMTOKEN section of the XML Schema Part 2: Datatypes Second Edition.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈