XPath testing dates
I've hunted high and low and found some very interesting functionality
with XPATH but, I haven't found a way to test DATES.
I have a Date attribute that I want to use to fetch a collection of nodes.
<History>
<item>
<Name>string</Name>
<Location>string</Location>
<VisitDate>01/08/2013</VisitDate>
<Description>string</Description>
</item>
</History>
The XPath code happily finds an equals, but I need to perform a => test.
Dim doc As New Xml.XmlDocument
doc.Load(filename)
Dim d As Date = DateAdd(DateInterval.Day, -7, Today)
s = "//History/item[VisitDate=>'" & d.ToString("dd/MM/yyyy") & "']"
Dim nodes As Xml.XmlNodeList = doc.SelectNodes(s)
Now this doesn't work. It errors out at the SelectNodes(s), so it
obviously doesn't like the ">" bit.
Are there any "Date" functions in XPath, I've found boolean(); concat();
true(); not true(); translate(); substring() etc, and I'm presuming that
I'm going to eventually have to use a combination of these, and maybe
others, but I can't figure out how to do "greater than"....
Is there anyone out there with an understanding of XPath in this area?
No comments:
Post a Comment