LINQ to XML

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi.
I have an xml file that looks like this and a few questions regarding LINQ to XML
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; templates<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; template <span style="color:Red; id<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1<span style="color:Black; " <span style="color:Red; description<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; basic template<span style="color:Black; " <span style="color:Red; displaytype<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; standard<span style="color:Black; "<span style="color:Blue; >
my template stuff goes here
<span style="color:Blue; </<span style="color:#A31515; template<span style="color:Blue; >

<span style="color:Blue; <<span style="color:#A31515; template <span style="color:Red; id<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 2<span style="color:Black; " <span style="color:Red; description<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; basic template #2<span style="color:Black; " <span style="color:Red; displaytype<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; revised<span style="color:Black; "<span style="color:Blue; >
my template stuff goes here2
<span style="color:Blue; </<span style="color:#A31515; template<span style="color:Blue; >

<span style="color:Blue; </<span style="color:#A31515; templates<span style="color:Blue; >
[/code]
1st question. <br/>
How can I select the value inside the template based on the ID attribute and put it into a string.
So get the "my template stuff goes here" into a string when ID = 1.
And the 2nd question.
How can I get a list of all the IDs, Descriptions, and DisplayTypes so that I can display them into a listview or something of the sort?
Ive been looking at LINQ to XML stuff all day and im just more confused now. LOL.
<br/>
Any help would be appreciated.



View the full article
 
Back
Top