Solved

asp.net c# xml

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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