I want to sort nodes of a certain parent node as they are parsed by
XMLDOMParser.

The following is what I tried so far. It causes the image to hang and CPU to
sweat. I've put half a day in - before I continue, what's the best way to do
this? Am I on the right path? It seems very complicated ( I almost feel like
I'm working with Morphic ;-) )

The parent node is XMLPageElement which is a subclass of XMLElement, in
which I overrode #nodesClass to return XMLSortedList.

XMLSortedList is a subclass of XMLNodeList with the following overrides:
    initialize
        self nodes sortBlock: self sortBlock.
    sortBlock
        ^ [ :a :b | a < b ].
    species
        ^ super XMLSortedList.
There is also XMLSortedList class>>collectionClass
        ^ SortedCollection.
The above overrides XMLOrderedList's use of OrderedCollection. I refactored
XMLOrderedList by pulling all references to OrderedCollection into this
method.

Thanks.
Sean

--
View this message in context: 
http://forum.world.st/Parsing-XML-into-sorted-elements-tp3615867p3615867.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to