order by date in XmlDom

Discussion in 'ASP General' started by Eduardo Rosa, Jun 30, 2004.

  1. Eduardo Rosa

    Eduardo Rosa Guest

    Hi, I need some help...
    I have a field type date in xml, loading with Microsoft.XMLDOM, how can I
    order by date?

    thanks a lot

    xml code:
    <Root>
    <Fields>
    <Field Id="456955" Date="01/05/1956" />
    <Field Id="159753" Date="21/06/1972" />
    <Field Id="769513" Date="14/07/1932" />
    </Fields>
    </Root>
     
    Eduardo Rosa, Jun 30, 2004
    #1
    1. Advertising

  2. Eduardo Rosa wrote:
    > Hi, I need some help...
    > I have a field type date in xml, loading with Microsoft.XMLDOM, how
    > can I order by date?
    >
    > thanks a lot
    >
    > xml code:
    > <Root>
    > <Fields>
    > <Field Id="456955" Date="01/05/1956" />
    > <Field Id="159753" Date="21/06/1972" />
    > <Field Id="769513" Date="14/07/1932" />
    > </Fields>
    > </Root>


    Your best solution would be to load them initially in the proper order (I
    assume they are coming from a database, so simply use an ORDER BY clause in
    the query used to retrieve these results.)

    If that is not possible for some reason, then you will get the fastest
    results from an xsl transformation, which is outside of the scope of this
    newsgroup. I suggest you post to an xml or xsl newsgroup.

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Jun 30, 2004
    #2
    1. Advertising

  3. Eduardo Rosa wrote:


    > I have a field type date in xml, loading with Microsoft.XMLDOM, how can I
    > order by date?


    > xml code:
    > <Root>
    > <Fields>
    > <Field Id="456955" Date="01/05/1956" />
    > <Field Id="159753" Date="21/06/1972" />
    > <Field Id="769513" Date="14/07/1932" />


    Consider using a format like yyyy-mm-dd then you can use string
    comparison. Otherwise you need to extract the year, month, day and
    compare, perhaps by recomposing to the format given. How you do that
    depends on the tools you want to use, with XSLT/XPath you can sort.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jun 30, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trip

    XMLHttpRequest + XMLDOM

    Trip, Oct 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    451
  2. Robert Zurer
    Replies:
    0
    Views:
    465
    Robert Zurer
    Jun 28, 2005
  3. Trip

    XMLHttpRequest + XMLDOM

    Trip, Oct 8, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    515
    intrader
    Oct 11, 2005
  4. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,295
    Michael Borgwardt
    May 30, 2004
  5. Lamberti Fabrizio
    Replies:
    0
    Views:
    637
    Lamberti Fabrizio
    Jun 23, 2004
Loading...

Share This Page