brady gaster

yadnb

a wee bit of help with serialization & dates...

So i have this idea, and i'm experiencing a little difficulty with an XPath expression i need to write. Here's a serialized Person object:

<Person xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <DOB>1972-10-31T00:00:00.0000000-05:00</DOB>
</Person>

So what i want to find out is this. i need to write an XPath query that basically takes a looks to see if the Person/DOB node is less than today. i've tried a few variations, but none seem to work? Anyone want to lend a hand with some simple XPath to query with a date?

(shames self for not knowing)

Comments

Matt Berther said:

Brady, I dont think there are any date checking expressions in the XPath spec that you can use.

You'll probably end up having to write an XSL extension object to accomplish this. An example can be found at http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=64.

Hope this helps out...
# February 5, 2004 11:50 AM

Fabrice said:

XML dates are in ISO 8601 format which lets you compare them directly (as strings).

More about ISO 8061 :
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
# February 5, 2004 12:29 PM

Mauricio Feijo said:

fabrice got it
# February 5, 2004 12:43 PM

Matt Berther said:

Right, but he doesnt have the *current* date, which is where the extension would come in to play...
# February 5, 2004 5:34 PM

Fabrice said:

We don't know if Brady is using XSLT.
If he generates and runs the XPath queries right from code, then incorporating the current date into the query is not a problem :-)
If you use XSLT, it's easier to pass the current date as a parameter to the XSLT document rather than creating an extension.
# February 10, 2004 4:47 AM

brady gaster said:

That's correct, Fabrice. Thing is (and i've not looked at the documentation at all on this one) - can you use XSL extensions within the XPath "stuff?" Probably not. Eh.
# February 10, 2004 8:15 AM

Fabrice said:

Not too sure what you call the XPath stuff...
# February 11, 2004 4:25 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)