|
An alternative approach could be to use the same algorithm used by the System.Xml.XmlConvert class in the .NET Framework described at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlconvertclasstopic.asp
From the documentation
"For example, if 'Order Detail' were a column heading in a database, the database allows the space between the words Order and Detail. However, in XML, the space between Order and Detail is considered an invalid XML character. Thus, the space, the invalid character, needs to be converted into an escaped hexadecimal encoding and can be decoded later.
...
The EncodeName method can be used with the XmlTextWriter class to ensure the names being written are valid XML names. The following C# code converts the name 'Order Detail' into a valid XML name and writes the element <Order_0x0020_Detail>"
|