Am 22.06.2011 um 05:11 schrieb Sean P. DeNigris:
I did the simplest thing I could think of and overrode XMLPageElement>>handleEndTag ^ self nodes sort: [ :a :b | a < b ].
It worked but feels like a hack. Anyone have anything better?
Why do need to sort while the parser is parsing? Can't you sort just afterwards? I think this is the cleanest approach. If you want to sort the elements immediately than you need custom classes like you wrote. Did you have a look at XMLPluggableElementFactory ? You can set a nodeFactory in the XMLDOMParser that should emit your classes while parsing. In your custom class there should be a possibility to override nodesClass in a clean way to get the list changes done. If not that would be a needed enhanced to the parser. Norbert