Solved

asp.net c# xml

Posted on 2014-11-10
1
86 Views
Last Modified: 2014-11-20
Below within if statement. How can I just read metaKyword?

 using (XmlTextReader reader = new XmlTextReader(Server.MapPath("Content/Website.xml")))
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Text)
                    {
                       
                            Response.Write(reader.Value);
                            Response.Write("<br>");
                       
                    }
                }
            }



<?xml version="1.0" encoding="utf-8"?>
<Website>  
  <metaKeywords>Keywords In Details</metaKeywords>
  <metaDescription>Decription In Details</metaDescription>
</Website>
0
Comment
Question by:ITsolutionWizard
1 Comment
 
LVL 5

Accepted Solution

by:
Ronak Patel earned 500 total points
ID: 40434349
Hi,

Refer below code.. it is possible using "XmlDocument".

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("Content/Website.xml"));

XmlNode xmlNode = xmlDoc.SelectSingleNode("Website").SelectSingleNode("metaKeywords");

Response.Write(xmlNode.InnerText);

Open in new window

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now