The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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 VerifyNCName method does the same function as VerifyName. However, it takes the non-qualified name as its parameter.

The following code example shows how VerifyName checks the name abc before using the name as an element name.

try {
catch (XmlException e){
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft