XmlConvert.VerifyNMTOKEN Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Verifies that the string is a valid NMTOKEN according to the W3C XML Schema Part2: Datatypes recommendation
Assembly: System.Xml (in System.Xml.dll)
Parameters
- name
- Type: System.String
The string you wish to verify.
| Exception | Condition |
|---|---|
| XmlException | The string is not a valid name token. |
| ArgumentNullException | name is null. |
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) {
//Display an error
}
For more information on the NMTOKEN data type, see XML Schema Part 2: Datatypes.