order by date in XmlDom

E

Eduardo Rosa

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>
 
B

Bob Barrows [MVP]

Eduardo said:
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
 
M

Martin Honnen

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top