Partial DocumentPrinter
implementation.
eu.cdevreeze.yaidom.simple.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
Document
s andElem
s. This package offers the eu.cdevreeze.yaidom.print.DocumentPrinter trait, as well as several implementations. Most of those implementations use theconvert
package to convert yaidomDocument
s 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)
convert
conversions. 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
DocumentPrinter
implementation does not use anyconvert
conversion. That isDocumentPrinterUsingSax
. It is likely the fastest of theDocumentPrinter
implementations, as well as the one using the least memory.The preferred
DocumentPrinter
for XML (not HTML) printing isDocumentPrinterUsingDomLS
, if memory usage is not an issue. ThisDocumentPrinter
implementation is best integrated with DOM, and is highly configurable, although DOM LS configuration is somewhat involved.This package depends on the eu.cdevreeze.yaidom.core, eu.cdevreeze.yaidom.queryapi, eu.cdevreeze.yaidom.simple and eu.cdevreeze.yaidom.convert packages, and not the other way around.