TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sudarvizhi J
NA
101
23.9k
How to read xml from string variable with particular tag
May 18 2018 4:42 AM
we have to use some code for single root value, but we need multiple root elements and particular tag name to read data.
We have to read xml string with particular tag name. Please advise ASAP
Here is my code we have to use single root value its working fine,
string xmlString = "<data><Date>5/15/2018</Date><Name>test test</Name><Course>Storyboarding</Course></data>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlNodeList nodes = doc.DocumentElement.SelectNodes("//data");
StringBuilder yourString = new StringBuilder();
foreach (XmlNode node in nodes)
{
yourString.Append("Date:" + node["Date"].InnerText + "<br />");
yourString.Append("Course:" + node["Course"].InnerText + ",");
}
PlaceHolder1.Controls.Add(new LiteralControl(yourString.ToString()));
Reply
Answers (
1
)
HOW TO CHECK FOR SUB ELEMENT OF AN XML FILE
How can i post list data to sql tbl in XML format.