Click here to Skip to main content
12,501,486 members (51,419 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# XML XPath
I have this Xml:

 <dbo>
    <Id>8270</Id>
    <FormName>new</FormName>
    <City>new</City>
    <ClaimNo>899</ClaimNo>
    <FDate>20/12/2012 00:00:00</FDate>
    <Amount>544</Amount>
    <GroupId>0</GroupId>
    <UpLoadDate>20/12/2012 12:06:27</UpLoadDate>
  </dbo>
<dbo>
    <Id>8271</Id>
    <FormName>new</FormName>
    <City>new</City>
    <ClaimNo>899</ClaimNo>
    <FDate>20/12/2012 00:00:00</FDate>
    <Amount>544</Amount>
    <GroupId>0</GroupId>
    <UpLoadDate>20/12/2012 12:06:27</UpLoadDate>
  </dbo>
<dbo>
    <Id>8272</Id>
    <FormName>new</FormName>
    <City>new</City>
    <ClaimNo>899</ClaimNo>
    <FDate>20/12/2012 00:00:00</FDate>
    <Amount>544</Amount>
    <GroupId>0</GroupId>
    <UpLoadDate>20/12/2012 12:06:27</UpLoadDate>
  </dbo>

I want to select the "UpLoadDate" from "dateTime 1" to "dateTime 2".
What is the Xpath query to do this in c#??
Thanks.
Posted 23-Dec-12 21:49pm
Comments
Oleksandr Kulchytskyi 24-Dec-12 4:12am
   
Ohhhh, Recently i have been observing such tendency that there are a lot of lazy people who write some questions with only one intent is to get code which would work properly , it's very frustrates ....
Try to do the best of yourself , and only then , in case of failure, ask a question...
engmebeed 24-Dec-12 4:14am
   
I am not lazy
i have tried more and more and no code work, i write this code :
XmlNodeList UpLoadDate = xmlDoc.SelectNodes("//DocumentElement/dbo[UpLoadDate >='20/12/2012 12:06:27' and UpLoadDate <'26/12/2012 12:06:27']");
and this not work and so on, so i need your help all if you could.
Thanks at all.
Oleksandr Kulchytskyi 24-Dec-12 4:19am
   
Sorry ,I had no purpose to hurt you... my approach is below , under your first comment

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

No, we won't give you solution.. We can't work out for you like this.. You should try it by yourself.. If you got stuck somewhere, you can certainly come here.. But don't ask directly for code..
-Krunal R
  Permalink  
Comments
engmebeed 24-Dec-12 4:11am
   
i have tried more and more and no code work, i write this code :
XmlNodeList UpLoadDate = xmlDoc.SelectNodes("//DocumentElement/dbo[UpLoadDate >='20/12/2012 12:06:27' and UpLoadDate <'26/12/2012 12:06:27']");
and this not work and so on, so i need your help all if you could.
Thanks at all.
Oleksandr Kulchytskyi 24-Dec-12 4:18am
   
It can be done purely bu using XPath...

xmlDoc.SelectNodes("//dbo[xs:date(./FDate@text()) > xs:date('given date') and myParameter[text()='given parameter']]")
engmebeed 24-Dec-12 4:37am
   
this query doesn't work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100