Support for "printing" yaidom Documents and Elems. This package offers the eu.cdevreeze.yaidom.print.DocumentPrinter
trait, as well as several implementations. Most of those implementations use the convert package to convert yaidom Documents to
JAXP artifacts, and all use JAXP (DOM, SAX or StAX).
For example:
val docPrinter = DocumentPrinterUsingSax.newInstance()
docPrinter.print(doc, "UTF-8", System.out)
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 any convert conversion. That is DocumentPrinterUsingSax. It is likely the
fastest of the DocumentPrinter implementations, as well as the one using the least memory.
The preferred DocumentPrinter for XML (not HTML) printing is DocumentPrinterUsingDomLS, if memory usage is not an
issue. This DocumentPrinter implementation is best integrated with DOM, and is highly configurable, although
DOM LS configuration is somewhat involved.
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 and eu.cdevreeze.yaidom.convert packages, and not the other way around.