XML : Setting value of XML leaf node

Creating an XML document in C#. For the leaf nodes I need to set the text/value like below:

  <location>      <city>Denver</city>      <state>CO</state>      <country>United States</country>  </location>    
  • When I'm setting the values of city, state, and country above, should I be using InnerText or InnerXml?
  • Does that answer change if I need to XML encode the 5 XML illegal characters (' " < > &) with System.Security.SecurityElement.Escape()?
  • If the value of the node is wrapped in a CDATA tag, does that change whether I user InnerText or InnerXml?

No comments:

Post a Comment