i have a URL string that i want to insert to an XMLDocument - XmlElement Node:
"http://xx.xxx.xxx.xx4:7000/SomeURL/Some/?Locale=asaf&;Portal=how"
when write this code :
XmlElement NodeElement = xmlDoc.CreateElement(nodeToCreate);
NodeElement.InnerText = propInfo.GetValue(requestData,null).ToString();
additionalParamsNode.AppendChild(NodeElement);
The Text in the 'NodeElement.InnerText' looks fine, but when i do the appendChild() an "&" is written inside the XMLElement additionalParamsNode. its like the XMLElement takes the InnerXML , not the InnerText of the NodeElement.
i dont want to write the string with "开发者_如何学编程amp" to the XML cause the link wont work.
how do i appendChild without changing "&" to "&"?
If I'm remembering correctly, &'s are one of the illegal characters in XML. That's why it is turned into & (the html equivalent of &).
You should be able to wrap the data in CDATA tags.
<![CDATA[http://xx.xxx.xxx.xx4:7000/SomeURL/Some/?Locale=asaf&;Portal=how]]>
You might have to parse out the CDATA tags when you are done though.
精彩评论