The character '=', the hexadecimal value 0x3D, cannot be included in the name

xmlnode = xmldoc.CreateElement(dRow.ItemArray.GetValue(0).ToString()); xmlroot.AppendChild(xmlnode); xmlnode.InnerText = sub; 
+4
source share
4 answers

You can use:

 string name = XmlConvert.EncodeName(dRow.ItemArray.GetValue(0).ToString()); 

to get a secure coded name, then

 xmlnode = xmldoc.CreateElement(name); 

but; as John notes, this is very unusual - and the coded name is not very beautiful; for example a=b becomes a_x003D_b .

+5
source

Look at the value of dRow.ItemArray.GetValue(0).ToString() . It appears that this is not a valid element name due to the inclusion of the = sign.

Relatively rarely, an element is created with a name specified dynamically from the data. Most often, the contents of an element are indicated in this way.

What exactly are you trying to achieve? What's on your line?

+4
source

The name is your answer. You cannot use '=' in a name.

+1
source

When you try to export the Microsoft directory to XML, the resulting file cannot be imported, and you will receive the following error message "The path / name of the XML file contains an error in the string." "The name contains an invalid character." If you check the XML catalog using Microsoft Visual Studio .NET, you receive the following error message: "Character" (hexadecimal value 0x28) cannot start the name. Line #, Position # "This problem occurs because the Commerce Server export did not encode the following special characters:

 The range 0x0021 – 0x002F includes ! " # $ % & ' ( ) * + , - . / The range 0x03A – 0x0040 includes : ; < = > ? @ The range 0x007B – 0x007E includes { | } ~ The range 0x005B – 0x005E [ \ ] ^** 
+1
source

All Articles