Partial DocumentPrinter implementation.
eu.cdevreeze.yaidom.Document printer (to the XML as a String or byte array).
DOM-based Document printer.
DOM-LS-based Document printer.
SAX-based Document printer.
StAX-based Document printer.
Thread-local DocumentPrinter.
Support for "printing" yaidom
Documents andElems. This package offers the eu.cdevreeze.yaidom.print.DocumentPrinter trait, as well as several implementations. Most of those implementations use theconvertpackage to convert yaidomDocuments to JAXP artifacts, and all use JAXP (DOM, SAX or StAX).For example:
This example chose a SAX-based implementation, and used the default configuration of that document printer.
Having several different fully configurable JAXP-based implementations shows that yaidom is pessimistic about the transparency of parsing and printing XML. It also shows that yaidom is optimistic about the available (heap) memory and processing power, because of the 2 separated steps of JAXP parsing/printing and (in-memory)
convertconversions. Using JAXP means that escaping of characters is something that JAXP deals with, and that's definitely better than trying to do it yourself.One
DocumentPrinterimplementation does not use anyconvertconversion. That isDocumentPrinterUsingSax. It is likely the fastest of theDocumentPrinterimplementations, as well as the one using the least memory.The preferred
DocumentPrinterfor XML (not HTML) printing isDocumentPrinterUsingDomLS, if memory usage is not an issue. ThisDocumentPrinterimplementation is best integrated with DOM, and is highly configurable, although DOM LS configuration is somewhat involved.This package depends on the eu.cdevreeze.yaidom and eu.cdevreeze.yaidom.convert packages, and not the other way around.