Results 1 to 7 of 7

Thread: XPath - Resolved.

Threaded View

  1. #1

    Thread Starter
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    XPath - Resolved.

    Right, I'm building a calendar selection. The month & year are known.

    Now, assuming I have an XML structure like this (from Sql Server):
    Code:
    <root>
    	<item>
    		<startdate>2003-08-01T16:00:00</startdate>
    		<enddate>2003-08-03T16:30:00</enddate>
    		<caption>Blah</caption>
    		<url>www.blah.com</url>
    		<color>navy</color>
    	</item>
    	<item>
    		<startdate>2003-08-01T10:00:00</startdate>
    		<enddate>2003-08-07T11:30:00</enddate>
    		<caption>Blah Again</caption>
    		<url>www.blah.com</url>
    		<color>silver</color>
    	</item>
    </root>
    So, with a loop through the days of the month, I've got the date (time can be ignored). Now what I've got to do, is check if the date falls within a date range.
    For example, in the above XML, lets say the date is 20030802. It falls between the start and end dates of both items. Now, I need the colors for both of these items. If the date was 20030804, only the second item's color is required.

    The problem I'm having is that I can't figure out how to use two child nodes in one predicate, using the substring function. This is all being done in C#, btw, and looping through each node in the Xml document & manually checking is easy enough, but why write all that code if you can get it with one XPath query?

    Thanks,
    Brian


    [Edit] Dates were in the wrong format.
    Last edited by axion_sa; Aug 7th, 2003 at 01:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width