xdocument to xmldocument query
Guys,
Can somebody help me take this from an xdocument linQ query syntax to something that will work in .net 3.0 please...
Thanks
Bob
Code:
'####### 3.5 ########
Dim document As XDocument = XDocument.Load(Session("str_XMLDataFile"))
Dim sectionName As String = XPathBinder.Eval(DataBinder.GetDataItem(e.AccordionItem), "@SectionName").ToString()
Dim questions = From question In document.Descendants("Question") _
Where question.Parent.Attribute("SectionName").Value = sectionName _
Select Text = question.Element("Text").Value, _
Comment = question.Element("Comment").Value, _
VDSCode = question.Element("VDSCode").Value, _
Category = question.Element("Category").Value, _
YesNo = question.Element("YesNo").Value
Dim lstQuestions As Repeater = TryCast(e.AccordionItem.FindControl("lstQuestions"), Repeater)
lstQuestions.DataSource = questions
lstQuestions.DataBind()
Example of XML Data...
Code:
<?xml version="1.0" encoding="utf-8" ?>
- <PPRObject>
- <Section SectionName="Major Part Assessment">
- <Question>
<Text>Datum, Secondary, Clearance Fixings</Text>
<DocumentLink>D:\Bentley\embededdocumentrequirements.doc</DocumentLink>
<Comment />
<Category />
<VDSCode />
<YesNo />
</Question>
- <Question>
<Text>Assistor required?</Text>
<DocumentLink>www.google.com</DocumentLink>
<Comment />
<Category />
<VDSCode />
<YesNo />
</Question>
- <Question>
<Text>Protection / Damage potential</Text>
<DocumentLink />
<Comment />
<Category />
<VDSCode />
<YesNo />
</Question>
- <Question>
Re: xdocument to xmldocument query
Is this a crosspost? I vaguely recall answering something similar by you in another thread.
Re: xdocument to xmldocument query
Yup. Delete if you have the POWERRRRRRRRR