My code now converts the special nodes *TOP*, *PI* and *COMMENT* to XML.
The *TOP* is just a mark for the tree root. The code just skips it and descends to children.
Conversion of *PI* was painful. The neet trick I used for attributes didn't work. So I had to write a function to extract text content from SXML. But having the function, conversion of *COMMENT* was trivial.
Unfortunately, I've left a bug. At the last moment I noticed that I had to escape special XML characters manually. I'll do it later.
The only SXML special nodes left are *ENTITY* and *NAMESPACES*. I'm frightened by the latter in advance. I'm afraid it will take a lot of time to implement all the gory details.
And, unexpectedly, *ENTITY* appeared to be a non-trivial task. It is used for unexpanded entity, but I want to have the normal entity! Going to complain in the ssax-sxml mailing list.