Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

## oracle.xml.parser.v2
Class XMLPrintDriver

`java.lang.Object
oracle.xml.parser.v2.XMLPrintDriver`

All Implemented Interfaces:
  PrintDriver

      public class XMLPrintDriver

extends java.lang.Object
implements PrintDriver

The `XMLPrintDriver` implements `PrintDriver` interface.

Field Summary
`protected java.util.Hashtable` `nsDeclToPrint`
`protected java.util.Vector` `nsVector`
`protected XMLOutputStream` `out` XMLOutputStream to print the serialized form.
`protected int` `prefixCount`
`protected java.util.Vector` `prefixVector`
`protected int` `prevSize`

Constructor Summary
`XMLPrintDriver(java.io.OutputStream os)` Create a new PrintDriver to output XML to OutputStream
`XMLPrintDriver(java.io.PrintWriter pw)` Create a new PrintDriver to output XML to PrintWriter

Method Summary
`void` `close()` Closes the output stream or print writer.
`void` `close(int option)` Closes the output stream or print writer based on option Legal values are: XMLOutputStream.REUSE and XMLOutputStream.NO_REUSE.
`void` `flush()` Flushes the output stream or print writer
`void` `printAttribute(XMLAttr attr)` Prints a `XMLAttr` node
`void` `printAttributeNodes(XMLElement elem)` Calls print method for each attribute of the `XMLElement`
`void` `printCDATASection(XMLCDATA cdata)` Prints a `XMLCDATA` node
`void` `printChildNodes(XMLNode node)` Calls print method for each child of the `XMLNode`
`void` `printComment(XMLComment comment)` Prints a `XMLComment` node
`void` `printDoctype(DTD dtd)` Prints an `DTD`.
`void` `printDocument(XMLDocument doc)` Prints an `XMLDocument`.
`void` `printDocumentFragment(XMLDocumentFragment dfrag)` Prints an empty `XMLDocumentFragment` object.
`void` `printElement(XMLElement elem)` Prints an `XMLElement`.
`void` `printEntityReference(XMLEntityReference en)` Prints a `XMLEntityReference` node
`protected void` `printNsDecls(XMLElement elem)` Print all namespace decl required in the current start elem
`void` `printProcessingInstruction(XMLPI pi)` Prints a `XMLPI` node
`void` `printTextNode(XMLText text)` Prints a `XMLText` node
`void` `setEncoding(java.lang.String enc)` Sets the encoding of the print driver.
`void` `setFormatPrettyPrint(boolean val)` Sets the pretty format print

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### out

    protected XMLOutputStream out

  XMLOutputStream to print the serialized form.

### prefixVector

    protected java.util.Vector prefixVector

### nsVector

    protected java.util.Vector nsVector

### prevSize

    protected int prevSize

### prefixCount

    protected int prefixCount

### nsDeclToPrint

    protected java.util.Hashtable nsDeclToPrint

Constructor Detail

### XMLPrintDriver

    public XMLPrintDriver(java.io.PrintWriter pw)

  Create a new PrintDriver to output XML to PrintWriter
  Parameters:
    `pw` - - PrintWriter to use for output

### XMLPrintDriver

    public XMLPrintDriver(java.io.OutputStream os)

  Create a new PrintDriver to output XML to OutputStream
  Parameters:
    `os` - - OutputStream to use for output

Method Detail

### setEncoding

    public void setEncoding(java.lang.String enc)
                     throws java.io.IOException

  Sets the encoding of the print driver.
  Specified by:
    `setEncoding` in interface `PrintDriver`
  Parameters:
    `enc` - The encoding of the document being printed.
  Throws:
    `java.io.IOException`

### setFormatPrettyPrint

    public void setFormatPrettyPrint(boolean val)

  Sets the pretty format print
  Parameters:
    `val` - boolean value

### printDoctype

    public void printDoctype(DTD dtd)
                      throws java.io.IOException

  Prints an `DTD`.
  Specified by:
    `printDoctype` in interface `PrintDriver`
  Parameters:
    `dtd` - The dtd to be printed.
  Throws:
    `java.io.IOException`

### printDocument

    public void printDocument(XMLDocument doc)
                       throws java.io.IOException

  Prints an `XMLDocument`.
  Specified by:
    `printDocument` in interface `PrintDriver`
  Parameters:
    `doc` - The document to be printed.
  Throws:
    `java.io.IOException`

### printElement

    public void printElement(XMLElement elem)
                      throws java.io.IOException

  Prints an `XMLElement`.
  Specified by:
    `printElement` in interface `PrintDriver`
  Parameters:
    `elem` - The element to be printed.
  Throws:
    `java.io.IOException`

### printDocumentFragment

    public void printDocumentFragment(XMLDocumentFragment dfrag)
                               throws java.io.IOException

  Prints an empty `XMLDocumentFragment` object.
  Specified by:
    `printDocumentFragment` in interface `PrintDriver`
  Parameters:
    `dfrag` - The document fragment to be printed.
  Throws:
    `java.io.IOException`

### printTextNode

    public void printTextNode(XMLText text)
                       throws java.io.IOException

  Prints a `XMLText` node
  Specified by:
    `printTextNode` in interface `PrintDriver`
  Parameters:
    `text` - The text node.
  Throws:
    `java.io.IOException`

### printComment

    public void printComment(XMLComment comment)
                      throws java.io.IOException

  Prints a `XMLComment` node
  Specified by:
    `printComment` in interface `PrintDriver`
  Parameters:
    `comment` - The comment node.
  Throws:
    `java.io.IOException`

### printCDATASection

    public void printCDATASection(XMLCDATA cdata)
                           throws java.io.IOException

  Prints a `XMLCDATA` node
  Specified by:
    `printCDATASection` in interface `PrintDriver`
  Parameters:
    `cdata` - The XMLCDATA node.
  Throws:
    `java.io.IOException`

### printProcessingInstruction

    public void printProcessingInstruction(XMLPI pi)
                                    throws java.io.IOException

  Prints a `XMLPI` node
  Specified by:
    `printProcessingInstruction` in interface `PrintDriver`
  Parameters:
    `pi` - The XMLPI node.
  Throws:
    `java.io.IOException`

### printAttribute

    public void printAttribute(XMLAttr attr)
                        throws java.io.IOException

  Prints a `XMLAttr` node
  Specified by:
    `printAttribute` in interface `PrintDriver`
  Parameters:
    `attr` - The XMLAttr node.
  Throws:
    `java.io.IOException`

### printEntityReference

    public void printEntityReference(XMLEntityReference en)
                              throws java.io.IOException

  Prints a `XMLEntityReference` node
  Specified by:
    `printEntityReference` in interface `PrintDriver`
  Parameters:
    `en` - The XMLEntityReference node.
  Throws:
    `java.io.IOException`

### printChildNodes

    public final void printChildNodes(XMLNode node)
                               throws java.io.IOException

  Calls print method for each child of the `XMLNode`
  Specified by:
    `printChildNodes` in interface `PrintDriver`
  Parameters:
    `node` - The node whose children are to be printed.
  Throws:
    `java.io.IOException`

### printAttributeNodes

    public final void printAttributeNodes(XMLElement elem)
                                   throws java.io.IOException

  Calls print method for each attribute of the `XMLElement`
  Specified by:
    `printAttributeNodes` in interface `PrintDriver`
  Parameters:
    `elem` - The elem whose attributes are to be printed.
  Throws:
    `java.io.IOException`

### flush

    public void flush()
               throws java.io.IOException

  Flushes the output stream or print writer
  Specified by:
    `flush` in interface `PrintDriver`
  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Closes the output stream or print writer. Migrate to close(int option).
  Specified by:
    `close` in interface `PrintDriver`
  Throws:
    `java.io.IOException`

### close

    public void close(int option)
               throws java.io.IOException

  Closes the output stream or print writer based on option Legal values are: XMLOutputStream.REUSE and XMLOutputStream.NO_REUSE.
  Parameters:
    `option` - determines whether output stream or print writer has to be closed.
  Throws:
    `java.io.IOException`

### printNsDecls

    protected void printNsDecls(XMLElement elem)
                         throws java.io.IOException

  Print all namespace decl required in the current start elem
  Throws:
    `java.io.IOException` - - If any error occurs while printing

Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.