XML Selecting Nodes

dashley

Well-known member
Joined
May 27, 2005
Messages
59
Location
Tennessee
Programming Experience
10+
I just discovered that the CF dosent support "SelectSingleNode" for the xmldocument. I have a xml doc that has anywhere from 10 to 50 questions. A sample is below. I'm trying to go into the xml doc and find a particular question and pull the childnodes when the question is found. I can get it in the reqular .net framwork like this:

Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
m_xmld = New XmlDocument
m_xmld.Load("1myxml.xml")
m_nodelist = m_xmld.SelectNodes("/Questions/Question")
For Each m_node In m_nodelist
Dim QIDAttribute = m_node.Attributes.GetNamedItem("QIDELEMENT").Value
If QIDAttribute = "3627" Then
Dim QID = m_node.ChildNodes.Item(0).InnerText
Dim EVALID = m_node.ChildNodes.Item(1).InnerText
Dim QSEQUENCE = m_node.ChildNodes.Item(2).InnerText
Dim QTEXT = m_node.ChildNodes.Item(3).InnerText
Dim QTYPE = m_node.ChildNodes.Item(4).InnerText
Dim QANSWERSET = m_node.ChildNodes.Item(5).InnerText
Dim QDEFAULTANS = m_node.ChildNodes.Item(6).InnerText
Dim QREQUIRED = m_node.ChildNodes.Item(7).InnerText
End If

Since the SelectSingleNode method isnt available I'm trying to find out how I can retrieve the node data I need.

Thanks
Dan


VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#008000]<Questions>
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]  <Question QIDELEMENT="3625">
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QID>3625</QID> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <EVALID>118</EVALID> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QSEQUENCE>1</QSEQUENCE> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QTEXT>Walter Brown, MD</QTEXT> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QTYPE>MC</QTYPE> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QANSWERSET>25</QANSWERSET> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QPARENT>-1</QPARENT> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]    <QDEFAULTANS>0</QDEFAULTANS> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]   <QREQUIRED>False</QREQUIRED> 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]</Question>
[/COLOR][/SIZE]
 
no, it's VS 2005
 

Latest posts

Back
Top