org.apache.fop.util

## Class DOM2SAX

- java.lang.Object
- - org.apache.fop.util.DOM2SAX

-     public class DOM2SAX
      extends java.lang.Object

  Helper class that produces a SAX stream from a DOM Document.

  Part of the code here copied and adapted from Apache Xalan-J, src/org/apache/xalan/xsltc/trax/DOM2SAX.java

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DOM2SAX(org.xml.sax.ContentHandler handler)` Main constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `writeDocument(org.w3c.dom.Document doc, boolean fragment)` Writes the given document using the given ContentHandler.
    `void` | `writeFragment(org.w3c.dom.Node node)` Writes the given fragment using the given ContentHandler.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DOM2SAX

          public DOM2SAX(org.xml.sax.ContentHandler handler)

      Main constructor
      Parameters:
        `handler` - the ContentHandler to send SAX events to

  - ### Method Detail

    - #### writeDocument

          public void writeDocument(org.w3c.dom.Document doc,
                                    boolean fragment)
                             throws org.xml.sax.SAXException

      Writes the given document using the given ContentHandler.
      Parameters:
        `doc` - DOM document
        `fragment` - if false no startDocument() and endDocument() calls are issued.
      Throws:
        `org.xml.sax.SAXException` - In case of a problem while writing XML

    - #### writeFragment

          public void writeFragment(org.w3c.dom.Node node)
                             throws org.xml.sax.SAXException

      Writes the given fragment using the given ContentHandler.
      Parameters:
        `node` - DOM node
      Throws:
        `org.xml.sax.SAXException` - In case of a problem while writing XML

Copyright 1999-2021 The Apache Software Foundation. All Rights Reserved.