Re: Sort vs data type

Eric Jeunieaux <[email protected]> Fri, 17 Jun 2005 15:02:09 +0200
Newsgroups gmane.comp.mozilla.devel.rdf
Message-ID <[email protected]>
Yes, I control the data source.

Here is my test case :

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns:NC="http://home.netscape.com/NC-rdf#"
          xmlns:test="http://test#">

   <rdf:Seq rdf:about="urn:Lst">
     <rdf:li rdf:resource="urn:item:1"/>
     <rdf:li rdf:resource="urn:item:2"/>
     <rdf:li rdf:resource="urn:item:3"/>
   </rdf:Seq>

   <rdf:Description rdf:about="urn:item:1">
     <test:id NC:parseType="Integer">11</test:id>
     <test:decimal>11.11</test:decimal>
     <test:date NC:parseType="Date">Thu Jan 01 1970 00:00:00 
GMT+0000</test:date>
   </rdf:Description>

   <rdf:Description rdf:about="urn:item:2">
     <test:id NC:parseType="Integer">2</test:id>
     <test:decimal>11.2</test:decimal>
     <test:date NC:parseType="Date">Thu Jan 11 1970 00:00:00 
GMT+0000</test:date>
   </rdf:Description>

   <rdf:Description rdf:about="urn:item:3">
     <test:id NC:parseType="Integer">1</test:id>
     <test:decimal>11.1</test:decimal>
     <test:date NC:parseType="Date">Thu Jan 02 1970 00:00:00 
GMT+0000</test:date>
   </rdf:Description>

</rdf:RDF>

If I'am right, the tree is sorted by the Sort function of 
nsXULTreeBuilder.cpp. Sort calls SortSubtree; SortSubtree calls 
NS_QuickSort; NS_QuickSort calls Compare and Compare calls 
PRInt32  CompareMatches(left->mMatch, right->mMatch);
.
I first wanted to overload the CompareMatches function but I red somewhere 
that nsXULTreeBuilder can't be modified.

Can you explain me more what you want to say by 'provide an alternate 
sortable resource' ?

In fact, even if there is no easy way to achieve that, I absolutely need 
it. So, maybe you can tell me what is for you the best way to resolve that 
problem.



At 12:17 17.06.2005 +0100, you wrote:
>>But I want to sort decimal numbers.
>
>Sorry, then I don't know an easy way to achieve that. If you control the 
>data source then it may be possible to provide an alternate sortable resource.