Solved

asp.net c# xml

Posted on 2014-11-10
1
85 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

15 Experts available now in Live!

Get 1:1 Help Now