1
Answer

XMLDocument reading CDATA and Commnets

Ask a question
Smart    Lucky

Smart Lucky

13y
3.4k
1
Hi
can i read CDATA in This way ....................? 

 
   XmlDocument doc = new XmlDocument();
  doc.Load(Server.MapPath("~/App_Data/XMLFile.xml"));
        XmlNodeList listnode = doc.GetElementsByTagName("book");
        foreach (XmlNode node in listnode)
        {
            if (node is XmlCDataSection)
            {
                Response.Write("CDATA i s"+node.innerText);
            }
        }

And

Can i read Commnets in this way.................?

   foreach (XmlNode node in listnode)
        {
            if (node is XmlComment)
            {
                Response.Write("Commnets are"+node.InnerText);
            }
        }














Answers (1)