Validate the Element and Attribute Names
The XmlConvert class contains two methods that check the characters in a name, and verifies that the name conforms to the rules set by the World Wide Web Consortium (W3C) in the Extensible Markup Language (XML) 1.0 (Second Edition) recommendation. The methods are:
The VerifyName method checks the characters and verifies that the name is valid. If the name is valid, it is returned from the method. If the name is not valid, an exception is thrown.
The following code example shows how VerifyName checks the name abc before using the name as an element name.