Groups | Blog | Home
all groups > dotnet xml > october 2005 >

dotnet xml : How to use Xpath for this XML


Rote Rote
10/13/2005 12:34:12 AM
I would like to query this xml below:-
If i use :-
nodeList = root.SelectNodes("/Voter/Question/Answer/Answer/text()")

I get to see "Male" but only if i remove the root tags:-
<NSurveyVoter xmlns="http://www.nsurvey.org/NSurveyVoter.xsd">
</NSurveyVoter>

But what i want to get to see as the output is to see
"What is your Gender?" and the "Male"
that means the question and the answer

which is the :- <QuestionText>What is your Gender?</QuestionText>
and the <Answer>Male</Answer>

Any ideas
Tahnks

<?xml version="1.0" encoding="utf-8" ?>
<NSurveyVoter xmlns="http://pop.com.xsd">
<Voter>
<VoterID>649</VoterID>
<SurveyID>13</SurveyID>
<VoteDate>2005-09-29T12:38:12.9700000+10:00</VoteDate>
<StartDate>2005-09-29T12:33:55.5330000+10:00</StartDate>
<IPSource>192.168.100.77</IPSource>
<Question>
<QuestionText>What is your Gender?</QuestionText>
<VoterID>649</VoterID>
<QuestionId>516</QuestionId>
<Answer>
<AnswerID>1802</AnswerID>
<Answer>Male</Answer>
<VoterId>649</VoterId>
<QuestionId>516</QuestionId>
<SectionNumber>0</SectionNumber>
</Answer>
</Question>
</voter>
</NSurveyVoter>



Martin Honnen
10/13/2005 2:38:55 PM


[quoted text, click to view]


[quoted text, click to view]

<http://www.faqts.com/knowledge_base/view.phtml/aid/34022/fid/616>

--

Martin Honnen --- MVP XML
Rote Rote
10/13/2005 6:18:03 PM
Thanks for the reply.



AddThis Social Bookmark Button