|
-
Feb 16th, 2009, 07:27 AM
#1
Thread Starter
Fanatic Member
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>
"I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings
-
Feb 18th, 2009, 11:54 AM
#2
Re: xdocument to xmldocument query
Is this a crosspost? I vaguely recall answering something similar by you in another thread.
-
Feb 23rd, 2009, 06:23 AM
#3
Thread Starter
Fanatic Member
Re: xdocument to xmldocument query
Yup. Delete if you have the POWERRRRRRRRR
"I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|