This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Microsoft XML > October 2005 > XPath and xs:dateTime
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
XPath and xs:dateTime
|
|
|
| Hi, I have an XML file where each node has a dateTime. Is it possible to make
an xpath querry that returns nodes which have a date older or newer then a
given value? It seems something common, but I fail to do it.
<softel:Obj>
<softel:ObjID>6ee28bc6-fed5-48c8-85c0-71057e40afb4</softel:InUitID>
<softel:ObjDescription>TestObj</softel:ObjDescription>
<softel:ObjTimestamp>2005-10-18T12:01:58</softel:ObjTimestamp>
</softel:Obj>
Thanks !
| |
| Gomolyako Eduard 2005-10-19, 6:43 pm |
| No, XPath 1.0 doesn't support datetime type.
..ben wrote:
> Hi, I have an XML file where each node has a dateTime. Is it possible to make
> an xpath querry that returns nodes which have a date older or newer then a
> given value? It seems something common, but I fail to do it.
>
> <softel:Obj>
> <softel:ObjID>6ee28bc6-fed5-48c8-85c0-71057e40afb4</softel:InUitID>
> <softel:ObjDescription>TestObj</softel:ObjDescription>
> <softel:ObjTimestamp>2005-10-18T12:01:58</softel:ObjTimestamp>
> </softel:Obj>
>
> Thanks !
| |
| Oleg Tkachenko [MVP] 2005-10-19, 6:43 pm |
| ..ben wrote:
> Hi, I have an XML file where each node has a dateTime. Is it possible to make
> an xpath querry that returns nodes which have a date older or newer then a
> given value? It seems something common, but I fail to do it.
>
> <softel:Obj>
> <softel:ObjID>6ee28bc6-fed5-48c8-85c0-71057e40afb4</softel:InUitID>
> <softel:ObjDescription>TestObj</softel:ObjDescription>
> <softel:ObjTimestamp>2005-10-18T12:01:58</softel:ObjTimestamp>
> </softel:Obj>
XPath doesn't support date-times directly (it was published before XML
Schema), but there are always extensions like EXSLT/EXSLT.NET or tricks
like this:
//softel:Obj[translate(softel:ObjTimestamp, '-T:', '') >
translate('2005-01-01T00:00:00', '-T:', '')]
--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|