<?xml version="1.0"?>
<AppXmlLogWritter>
<LogData>
<LogID>5678201301161640382919</LogID>
<LogDateTime>20130114164038</LogDateTime>
</LogData>
<LogData>
<LogID>5678201301161640382920</LogID>
<LogDateTime>20130115154040</LogDateTime>
</LogData>
<LogData>
<LogID>5678201301161640382921</LogID>
<LogDateTime>20130116164042</LogDateTime>
</LogData>
</AppXmlLogWritter>
strXpathQuery = @"/AppXmlLogWritter/LogData[LogDateTime/text()>=[starts-with(. , '20130115') and LogDateTime/text()<=starts-with(. , '20130116')]";
我必须编写xpath查询来选择LogDateTime以20130115到20130117开头的范围内的logdata 我正在尝试上面的查询,但无法获取数据
答案 0 :(得分:1)
请试一试:
/AppXmlLogWritter/LogData[substring(LogDateTime, 1, 8) >= 20130115
and substring(LogDateTime, 1, 8) <= 20130116]
如果要在选择中包含20130117项,则应将“20130116”值更改为“20130117”。