XML serializers PreviousNext

Serializing an XM_DOCUMENT

To serialize an XM_DOCUMENT, you should use an XM_NODE_PROCESSOR to generate an event stream, and send this event stream into one of the serializers mentioned below.

The convenience class XM_FORMATTER does this for you with the XM_PRETTY_PRINT_FILTER serializer.

Event stream serializers

The following event-stream serializers are provided directly within Gobo:

This provides basic pretty-printing of the body of an XML document. It does not add any indentation, so it is not all that pretty.
This adds indentation to XM_PRETTY_PRINT_FILTER, so the output is more what you might expect from a pretty printer.
This prints QNames in Clark notation. The resulting output is not well-formed XML.
This prints DTD declarations. It does not generate a properly well-formed internal subset DTD, so should probably not be used for serialzing. It is rather meant as a debugging aid, i think.
XSLT 2.0 and XQuery 1.0 Serialization
The XSLT library includes a serializer that conforms to the XSLT 2.0 and XQuery 1.0 Serialization specification, and so gives you all the customizing power of an xsl:output statement. It is not necessary to invoke the XSLT engine in order to use this serializer, although you do need to include the XPath and XSLT library clusters (just include the XSLT library.xace file in your system.xace file).

To see how to use the serializer, refer to ${GOBO}/library/xslt/example/serializer/Readme.md, or to the documentation in XSLT 2.0 Serializer.

Copyright 2007-2017, Colin Adams
Last Updated: 8 January 2017