Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Puffin Rock Characters Plush Toy Set
anil1961
Updated:
Today at 3:51 PM
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Wednesday at 10:50 AM
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Monday at 12:26 PM
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Sunday at 12:41 PM
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
read xml using c# help need
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="madbuddy" data-source="post: 13641032" data-attributes="member: 266382"><p><span style="font-size: 22px">1.You have to convert your xml to below format in order to get the node set relevant to a title.</span></p><p><span style="font-size: 22px"></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"><item> </span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"> <title name="My Title"></span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"> <link>mysite.com</link> </span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"> <pubDate>Mon, 15 Oct 2012 04:39:41 GMT</pubDate> </span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"> <description>this is my web site</description> </span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"> <category>Computer</category></span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"> </title></span></span></span></p><p><span style="font-size: 22px"><span style="color: DarkOrange"><span style="color: Green"></item></span></span></span></p><p><span style="font-size: 22px"></span></p><p><span style="font-size: 22px">2.I have used c#,XML and Xpath to check & retrieve values from the XML</span></p><p><span style="font-size: 22px"></span></p><p><span style="font-size: 22px">using System.Xml;</span></p><p><span style="font-size: 22px"></span></p><p> <span style="font-size: 22px"><span style="color: Green">//Creates a new XML documet</span></span></p><p> <span style="font-size: 22px">XmlDocument _xml = new XmlDocument();</span></p><p><span style="font-size: 22px"></span></p><p><span style="font-size: 22px"><span style="color: green">//Loads the externam XMl doc to the code</span></span></p><p><span style="font-size: 22px">_xml.Load("xml_path");</span></p><p><span style="font-size: 22px"></span></p><p><span style="font-size: 22px"><span style="color: green">//Select all title element to a XMLNodeList </span></span></p><p><span style="font-size: 22px">XmlNodeList _list = _xml.SelectNodes("//item//title");</span></p><p><span style="font-size: 22px"></span></p><p><span style="font-size: 22px"><span style="color: green">//Looping each and check for the relevant node set</span></span></p><p><span style="font-size: 22px">foreach (XmlElement _ele in _list)</span></p><p><span style="font-size: 22px">{</span></p><p><span style="font-size: 22px"> if (_ele.Attributes["name"].InnerText.Equals("My Title"))</span></p><p><span style="font-size: 22px"> {</span></p><p><span style="font-size: 22px"> string _link = _ele.SelectSingleNode("//link").InnerText;</span></p><p><span style="font-size: 22px"> }</span></p><p><span style="font-size: 22px">}</span></p></blockquote><p></p>
[QUOTE="madbuddy, post: 13641032, member: 266382"] [SIZE="6"]1.You have to convert your xml to below format in order to get the node set relevant to a title. [COLOR="DarkOrange"][COLOR="Green"]<item> <title name="My Title"> <link>mysite.com</link> <pubDate>Mon, 15 Oct 2012 04:39:41 GMT</pubDate> <description>this is my web site</description> <category>Computer</category> </title> </item>[/COLOR][/COLOR] 2.I have used c#,XML and Xpath to check & retrieve values from the XML using System.Xml; [COLOR="Green"]//Creates a new XML documet[/COLOR] XmlDocument _xml = new XmlDocument(); [COLOR="green"]//Loads the externam XMl doc to the code[/COLOR] _xml.Load("xml_path"); [COLOR="green"]//Select all title element to a XMLNodeList [/COLOR] XmlNodeList _list = _xml.SelectNodes("//item//title"); [COLOR="green"]//Looping each and check for the relevant node set[/COLOR] foreach (XmlElement _ele in _list) { if (_ele.Attributes["name"].InnerText.Equals("My Title")) { string _link = _ele.SelectSingleNode("//link").InnerText; } }[/SIZE] [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom