XPath expression to get values between dates
I have xml stored in a xmltype table in a (Oracle Database) if the database matters
<?xml version="1.0"?>
<myDate xmlns="http://www.example.com/schema" dateTimeProc="20100824T102806" Num="666" timId="4" procId="1" proces="501"> 开发者_运维问答
</myDate>
<?xml version="1.0"?>
<myDate xmlns="http://www.example.com/schema" dateTimeProc="20101110T102806" Num="666" timId="4" procId="1" proces="501">
</myDate>
I would like to know whats the xpath expression to get all xml's that are between certain dates something like
select * from XMLTable
where existsNode(object_value,'myDate[@dateTimeProc]')
between sysdate-120 and sysdate-90
I was interested so I started looking around. Apparently according to http://www.eggheadcafe.com/articles/20030627d.asp the AND directive is allowable in an xpath query.
I know that you can use > and < in the queries (according to http://www.w3schools.com/xpath/xpath_syntax.asp)
So I would try:
//myDate[@dateTimeProc < X and @dateTimeProc > Y]
(where X and Y are a unix timecode that you get out of whatever code/language you're using)
精彩评论