Click here to Skip to main content
Rate this: bad
good
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 22:49pm
Comments
Oleksandr Kulchytskyi at 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 at 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 at 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 at 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 at 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 at 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
0 OriginalGriff 280
1 Sebastiaan Meijerink 145
2 Sergey Alexandrovich Kryukov 108
3 Abhinav S 94
4 BillWoodruff 85
0 Sergey Alexandrovich Kryukov 6,558
1 OriginalGriff 6,268
2 Peter Leow 2,534
3 Abhinav S 2,344
4 Maciej Los 2,297


Advertise | Privacy | Mobile
Web04 | 2.8.150414.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2015
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