List Info

Thread: C-Sharp (C#) Group: Re: XPath Query




C-Sharp (C#) Group: Re: XPath Query
user name
2006-07-18 17:33:59
Raj,
     The first thing that I could tell you is that your XML
schema is
your only problem. The way you have the data formatted now
violates the
entire principal behind the XML syntactical structure.
Trying something
akin to the following...
---
<?xml version="1.0"
encoding="utf-8" ?>
<ThematicStudies>
  <Study ID="1" Code="INSPSTUDY1"
Title="Some title.">
    <Question ID="1"
Grade="1">
      <Inquiry>What is the answer to my first
question?</Inquiry>
      <Response>The answer is clear,
grass-hopper.</Response>
    </Question>
    <Question ID="2"
Grade="1">
      <Inquiry>What is the answer to my second
question?</Inquiry>
      <Response>The answer is not so clear,
grass-hopper.</Response>
    </Question>
  </Study>
</ThematicStudies>
---
... you would be able to have much more control over your
data. Getting
the responses at that point would be as simple as:
---
xdoc.SelectNodes("ThematicStudies/Study[ID="1"]/Question/Response/text()");
---
I hope that helps you out. As far as answering your exact
question, I
can say that a.) it's bad practice, and b.) it's not
feasible since the
node wild-carding in XPath only supports the full node's
name.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: XPath Query
user name
2006-07-18 18:30:51
Hi,

Thanks for the reply. You are right formatted xml would have
made life
easier but we have to work with existing xml which is like
this. So
Sad.

Thanks anyway.

Raj


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )