| Neil Smith [MVP Digital Media] 2004-03-20, 11:29 am |
| 1) Store your dates in serialised format, as numbers. Then you can do
comparisons easily - so rather than 2004-05-06 , store as 20040506
(yyyymmdd) as they will always be sequential. Make sure to use leading
zeros for day and month though ;-)
Then you can do things like
selectSingleNode("/competitions/competition[date > 20040506]");
which should select the 2004-06-06 node following the last 2004-05-06
node. Finally you should then be able to create a node on the document
and use insertBefore to insert it above the node you just selected.
HTH
Neil.
On 20 Mar 2004 04:57:48 -0800, h00frepe@du.se (Froad) wrote:
>My problem is this: I want to add a node to my XML based on a date. I
>dont want the node to be in the bottom of the list or in the top. I
>want it to be inserted based on what date the datenode is. My xml
>looks like this:
>
><competitions>
> <competition>
> <name>US masters</name>
> <date>2004-05-06</date>
> </competition>
> <competition>
> <name>British Open
> <date>2004-06-06</date>
> </competition>
></competitions>
>
>If I now want to add a competition that is going to take place between
>those two I get a problem.
>
>How do i do that?
>
>Im writing in visual studion :NET, VB.
========================================================
CaptionKit http://www.captionkit.com : Produce subtitled
internet media, transcripts and searchable video. Supports
Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world.
|