469,343 Members | 5,186 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

XPath problem with dateTime strings comparison

Hello,

I've got an XML file saved from DataSet. One table has datetime column
(datatype - xs:dateTime). XML file fragment for example:

<Root>
<Element>2004-03-15T00:00:00.0000000+01:00</Element>
<Element>2004-03-16T00:00:00.0000000+01:00</Element>
<Element>2004-03-17T00:00:00.0000000+01:00</Element>
<Element>2004-03-18T00:00:00.0000000+01:00</Element>
</Root>

I'm trying to get MyXmlNodeList using
MyXmlDataDocument.DocumentElement.SelectNodes(MyXP athString) method, where
MyXPathString, for example, should look like:
"/Root/Element[DateFrom >= '2004-03-16T00:00:00.0000000+01:00']"

Problem: None of nodes are selected/returned if I use ">=" or "<="
comparison operators, but I could get a result using "=" operator.

Question: How to compare datetime strings?
Thank you,
Viktor
Nov 12 '05 #1
4 9320
See the following article:
http://www.biglist.com/lists/xsl-lis.../msg00492.html

"Viktor Jevdokimov" <vj*********@hotmail.com> skrev i meddelandet
news:uL**************@TK2MSFTNGP09.phx.gbl...
Hello,

I've got an XML file saved from DataSet. One table has datetime column
(datatype - xs:dateTime). XML file fragment for example:

<Root>
<Element>2004-03-15T00:00:00.0000000+01:00</Element>
<Element>2004-03-16T00:00:00.0000000+01:00</Element>
<Element>2004-03-17T00:00:00.0000000+01:00</Element>
<Element>2004-03-18T00:00:00.0000000+01:00</Element>
</Root>

I'm trying to get MyXmlNodeList using
MyXmlDataDocument.DocumentElement.SelectNodes(MyXP athString) method, where
MyXPathString, for example, should look like:
"/Root/Element[DateFrom >= '2004-03-16T00:00:00.0000000+01:00']"

Problem: None of nodes are selected/returned if I use ">=" or "<="
comparison operators, but I could get a result using "=" operator.

Question: How to compare datetime strings?
Thank you,
Viktor

Nov 12 '05 #2
And use XmlDocument instead of XmlDataDocument
Yan

"Magnus" <Ma********@discussions.microsoft.com> wrote in message
news:OX**************@TK2MSFTNGP11.phx.gbl...
See the following article:
http://www.biglist.com/lists/xsl-lis.../msg00492.html

"Viktor Jevdokimov" <vj*********@hotmail.com> skrev i meddelandet
news:uL**************@TK2MSFTNGP09.phx.gbl...
Hello,

I've got an XML file saved from DataSet. One table has datetime column
(datatype - xs:dateTime). XML file fragment for example:

<Root>
<Element>2004-03-15T00:00:00.0000000+01:00</Element>
<Element>2004-03-16T00:00:00.0000000+01:00</Element>
<Element>2004-03-17T00:00:00.0000000+01:00</Element>
<Element>2004-03-18T00:00:00.0000000+01:00</Element>
</Root>

I'm trying to get MyXmlNodeList using
MyXmlDataDocument.DocumentElement.SelectNodes(MyXP athString) method,
where
MyXPathString, for example, should look like:
"/Root/Element[DateFrom >= '2004-03-16T00:00:00.0000000+01:00']"

Problem: None of nodes are selected/returned if I use ">=" or "<="
comparison operators, but I could get a result using "=" operator.

Question: How to compare datetime strings?
Thank you,
Viktor


Nov 12 '05 #3
As I thought. Thanks.

"Magnus" <Ma********@discussions.microsoft.com> wrote in message
news:OX**************@TK2MSFTNGP11.phx.gbl...
See the following article:
http://www.biglist.com/lists/xsl-lis.../msg00492.html

"Viktor Jevdokimov" <vj*********@hotmail.com> skrev i meddelandet
news:uL**************@TK2MSFTNGP09.phx.gbl...
Hello,

I've got an XML file saved from DataSet. One table has datetime column
(datatype - xs:dateTime). XML file fragment for example:

<Root>
<Element>2004-03-15T00:00:00.0000000+01:00</Element>
<Element>2004-03-16T00:00:00.0000000+01:00</Element>
<Element>2004-03-17T00:00:00.0000000+01:00</Element>
<Element>2004-03-18T00:00:00.0000000+01:00</Element>
</Root>

I'm trying to get MyXmlNodeList using
MyXmlDataDocument.DocumentElement.SelectNodes(MyXP athString) method, where MyXPathString, for example, should look like:
"/Root/Element[DateFrom >= '2004-03-16T00:00:00.0000000+01:00']"

Problem: None of nodes are selected/returned if I use ">=" or "<="
comparison operators, but I could get a result using "=" operator.

Question: How to compare datetime strings?
Thank you,
Viktor


Nov 12 '05 #4
Yan Leshinsky wrote:
And use XmlDocument instead of XmlDataDocument


Or even XPathDocument if you only need to query data, not edit.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Donnal Walter | last post: by
1 post views Thread by Hollywood | last post: by
4 posts views Thread by elziko | last post: by
2 posts views Thread by Nishad | last post: by
3 posts views Thread by jmagaram | last post: by
3 posts views Thread by MikeL | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.