linq xml parsing

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi i need to parse an xml that looks like this:

<div style="color:black; background-color:white
<pre><span style="color:blue <?<span style="color:#a31515 xml <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 1.0<span style="color:black "<span style="color:blue ?><br/><span style="color:blue <<span style="color:#a31515 main<span style="color:blue ><br/> <span style="color:blue <<span style="color:#a31515 one<span style="color:blue >C:folder1<span style="color:blue </<span style="color:#a31515 one<span style="color:blue ><br/> <span style="color:blue <<span style="color:#a31515 two<span style="color:blue >C:folder2<span style="color:blue </<span style="color:#a31515 two<span style="color:blue ><br/> <span style="color:blue <<span style="color:#a31515 three<span style="color:blue >C:folder3<span style="color:blue </<span style="color:#a31515 three<span style="color:blue ><br/><span style="color:blue </<span style="color:#a31515 main<span style="color:blue ><br/>[/code]


i have the following code for xml parsing:

<div style="color:black; background-color:white
<pre> <span style="color:blue private <span style="color:blue void buildmachinepathselection()<br/> {<br/> XDocument pathdoc = XDocument.Load(<span style="color:#a31515 @"C:GUIpath.xml");<br/> <span style="color:blue var abc = <span style="color:blue from target <span style="color:blue in pathdoc.Descendants(<span style="color:#a31515 "target")<br/> ...<br/> ...<br/><br/> }<br/>[/code]


Basically it goes like this:
my combo boxes items:
"6.00" (combobox.selectedindex=0)
"6.10" (combobox.selectedindex=1)
"6.20" (combobox.selectedindex=2)
if i choose 6.00 i need to load this folder: "C:folder1"
if i choose 6.10 i need to load this folder: "C:folder2"
if i choose 6.20 i need to load this folder: "C:folder3"

so all these folder paths are saved in my xml file as xml text content.
how do i parse this xml file and then save these as a string?

<br/>
<br/>
<br/>

View the full article
 
Back
Top