Reputation: 1354
i am gettting problem while encoding string R.F.< 1 into Xml
i am using node.innerxml=string;
it shows exeption name cannot start with 1 or hexadecimal value 0x33.....
pls help me to solve this
Upvotes: 1
Views: 419
Reputation: 59443
The InnerXml
property of an XmlNode
instance accepts only well-formed XML text. Whenever you attempt to apply the string R.F.< 1
, the less-than character is being interpreted as the beginning of an XML element tag. Since an element name cannot begin with a digit, the XML is deemed not to be well-formed, and the set operation fails.
If you wish to put arbitrary text inside an XmlNode, then you should use the InnerText
property rather than the InnerXml
property. This will ensure that the less-than character is properly escaped (R.F.< 1
) in the resulting XML document.
Upvotes: 1
Reputation: 3413
When encoding to XML you need to consider reserved XML characters, and encode them accordingly.
Upvotes: 0