I'm new to Saxon and I must write an XML to SGML converter. My vision consists in writing an SGML Emitter derivating from XML Emitter.
Could you tell me some advises before starting ? Is there some instructive source examples from I could start ?
Thanks a lot.
I'm a little puzzled by the requirement because I thought XML was a subset of SGML, but I guess you know what you are doing...
You might find your solution more portable if you write it as a SAX ContentHandler rather than as a Saxon Receiver. On the other hand, it will be easier to reuse code in the existing Saxon serializer if you define it as a subclass of say XMLEmitter or HTMLEmitter. You can nominate either a Receiver or a ContentHandler as the destination for Saxon result trees.
Note also that any attributes on the xsl:output element in your own private namespace will be accessible to your serialization code ifyou write it as a Receiver. This provides an easy way to parameterize your serializer.
Apart from that I can't really suggest anything that you won't get from a study of the existing source code.
Thank you for your very useful answer. The SAX ContentHandler solution is really better, and seems to suit well with my problematic, which is to process heavy SGML files with rules. Because of a lack of native solutions, I transform SGML to XML before, I apply XSL rules, and finally, I must transform XML to SGML.
Because I'm a newbie, all advises are welcome...
Note that SGML has its own (complicated) transform language called DSSSL, which may be more suitable to your situation.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.