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:

XM_PRETTY_PRINT_FILTER
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.
XM_INDENT_PRETTY_PRINT_FILTER
This adds indentation to XM_PRETTY_PRINT_FILTER, so the output is more what you might expect from a pretty printer.
XM_NAMESPACE_PRETTY_PRINT_FILTER
This prints QNames in Clark notation. The resulting output is not well-formed XML.
XM_DTD_PRETTY_PRINT_FILTER
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.ecf in your system.ecf 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-2019, Colin Adams
mailto:colin@colina.demon.co.uk
http://www.gobosoft.com
Last Updated: 17 March 2019
HomeTocPreviousNext