The OMSGMLWRITE library can be used to convert a markup event stream to a well-formed SGML document
instance. The library exports two functions, sgml.writer
and sgml.written
. Each function
performs the same task through a different interface; which one is better to use depends on the context.
The following example program parses well-formed SGML input and uses the OMSGMLWRITE library to write it out as
SGML again.
import "omsgmlwrite.xmd" prefixed by sgml. process do sgml-parse document scan #main-input output sgml.written from #content done
This program can be used to normalize well-formed SGML instances. All SGML produced by the OMSGMLWRITE library has the following properties:
"
,
cdata
and sdata
entities are represented as entity references, and
<
and &
in data content are followed by the empty markup
declaration <!>
,
for example).