XML

Hi,

How can I decode data in an XML string Like when I get something like &gt; or &lt; in the raw strings, I would like to read or store them as > or < in my application.

Regards

Kiran Kumar Pinjala.




Answer this question

XML

  • DattaK

    If you use the Xml classes in .NET to read it you should get the decoded data.

  • Todd Biggs - Windows Live

    Have you tried the Value property



  • DalekDAW

    When you have a node with test and childnodes you need to iterate through the nodes childs and find its Text node. Here is a sample code that will do just that.

    XmlNode node = doc.SelectSingleNode("/root");
    foreach (XmlNode nodetest in
    node.ChildNodes)
    {
    if (XmlNodeType
    .Text == nodetest.NodeType)
    {
    System.Diagnostics.
    Debug
    .WriteLine(nodetest.Value);
    break
    ;
    }
    }



  • Jessica Alba

    Thanks Andreas, I was using InnerXML and this did not decode the data, So, i switched to InnerText and this did decode the data. The only thing that worries me is when I have children, then InnerText will return me a concatenated string of all the children, that I have.



  • toniSQL

    I tried the Value property, But it does not return me anything. It just returns an empty string.

  • XML