Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding a specific element

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
US

Hi,
I'm using an xmltextreader in .net2003 with the compact framework for a handheld app.

I have a file that can contain anywhere from 10 to 40 quesitons (sample below).

I'm using a "While reader.Read()" statement to go through the list and I'm tryig to grab an item from the file based mainly on the <QSEQUENCE> tag.

I want to say - if reader.name = "QSEQUENCE" and the qsequence value is "3" then ..

From there I want to pull and assign all the values (QID, evalid, Qtext etc..) for QSEQENCE 3 to variables and put them to use.

I cant seem to figure out the right way to do it.
Can it be done useing the xmltextreader?

Thanks

Dan

Code:
- <Question QIDELEMENT="3625">
  <QID>3625</QID> 
  <EVALID>118</EVALID> 
  <QSEQUENCE>1</QSEQUENCE> 
  <QTEXT>Walter Brown, MD</QTEXT> 
  <QTYPE>MC</QTYPE> 
  <QANSWERSET>25</QANSWERSET> 
  <QPARENT>-1</QPARENT> 
  <QDEFAULTANS>0</QDEFAULTANS> 
  <QREQUIRED>False</QREQUIRED> 
  </Question>
- <Question QIDELEMENT="3627">
  <QID>3627</QID> 
  <EVALID>118</EVALID> 
  <QSEQUENCE>3</QSEQUENCE> 
  <QTEXT>Liz Burton, CRNA</QTEXT> 
  <QTYPE>MC</QTYPE> 
  <QANSWERSET>25</QANSWERSET> 
  <QPARENT>-1</QPARENT> 
  <QDEFAULTANS>0</QDEFAULTANS> 
  <QREQUIRED>False</QREQUIRED> 
  </Question>
 
Why not load it into XmlDocument, then use SelectSingleNode()?

Jon

"I don't regret this, but I both rue and lament it.
 
JontyNM,

Thanks. I'll look into the xml document. Havent used it before.
 
Jonty

Just my luck the SelectSingleNode isn't supported in the compact framework. I'll keep digging around mabey the offer somthing else
 
tsuji

Hi. WHen I tried using it I received an error:
'SelectSingleNode' is not a member of 'system.xml.xmldocument'

I also looked in the support docuementaion and got.
//////
The .NET Compact Framework provides basic XML functionality including the XML Document Object Model (DOM). To save space, the following XML components are not supported:

XML schema validation

XmlDataDocument class

xpath queries, including node selecting methods that take xpath parameters

Extensible Stylesheet Language Transformation (XSLT)
/////

I even downloaded a class libreary reference for CF and it showed the selectsinglenode as grayed out(not supported).

I'm going to give the work around a try and see how it does.

Thanks alot

Dan


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top