Package groovy.util

## Class XmlNodePrinter

- java.lang.Object
- - groovy.util.XmlNodePrinter

-     @Deprecated
      public class XmlNodePrinter
      extends Object

  Deprecated.
  use `XmlNodePrinter`
  Prints a `groovy.util.Node` (as used with `XmlParser`) including all children in XML format. Typical usage:

       def xml = '<html><head><title>Title</title></head><body><h1>Header</h1></body></html>'
       def root = new XmlParser().parseText(xml)
       new XmlNodePrinter(preserveWhitespace:true).print(root.body[0])

  which when run produces this on stdout (or use your own `PrintWriter` to direct elsewhere):

       <body>
         <h1>Header</h1>
       </body>

  See Also:
    `NodePrinter`, `XmlUtil.serialize(Node)`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected static class` | `XmlNodePrinter.NamespaceContext` | Deprecated.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected IndentPrinter` | `out` | Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XmlNodePrinter()` | Deprecated.
    `XmlNodePrinter​(IndentPrinter out)` | Deprecated.
    `XmlNodePrinter​(IndentPrinter out, String quote)` | Deprecated.
    `XmlNodePrinter​(PrintWriter out)` | Deprecated.
    `XmlNodePrinter​(PrintWriter out, String indent)` | Deprecated.
    `XmlNodePrinter​(PrintWriter out, String indent, String quote)` | Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `getQuote()` | Deprecated. Get Quote to use when printing attributes.
    `boolean` | `isExpandEmptyElements()` | Deprecated. Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
    `boolean` | `isNamespaceAware()` | Deprecated. Check if namespace handling is enabled.
    `boolean` | `isPreserveWhitespace()` | Deprecated. Check if whitespace preservation is enabled.
    `void` | `print​(Node node)` | Deprecated.
    `protected void` | `print​(Node node, XmlNodePrinter.NamespaceContext ctx)` | Deprecated.
    `protected void` | `printLineBegin()` | Deprecated.
    `protected void` | `printLineEnd()` | Deprecated.
    `protected void` | `printLineEnd​(String comment)` | Deprecated.
    `protected void` | `printList​(List list, XmlNodePrinter.NamespaceContext ctx)` | Deprecated.
    `protected void` | `printName​(Node node, XmlNodePrinter.NamespaceContext ctx, boolean begin, boolean preserve)` | Deprecated.
    `protected void` | `printNameAttributes​(Map attributes, XmlNodePrinter.NamespaceContext ctx)` | Deprecated.
    `protected void` | `printNamespace​(Object object, XmlNodePrinter.NamespaceContext ctx)` | Deprecated.
    `protected void` | `printSimpleItem​(Object value)` | Deprecated.
    `protected boolean` | `printSpecialNode​(Node node)` | Deprecated.
    `void` | `setExpandEmptyElements​(boolean expandEmptyElements)` | Deprecated. Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
    `void` | `setNamespaceAware​(boolean namespaceAware)` | Deprecated. Enable and/or disable namespace handling.
    `void` | `setPreserveWhitespace​(boolean preserveWhitespace)` | Deprecated. Enable and/or disable preservation of whitespace.
    `void` | `setQuote​(String quote)` | Deprecated. Set Quote to use when printing attributes.

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

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

- - ### Field Detail

    - #### out

          protected final IndentPrinter out

      Deprecated.

  - ### Constructor Detail

    - #### XmlNodePrinter

          public XmlNodePrinter​(PrintWriter out)

      Deprecated.

    - #### XmlNodePrinter

          public XmlNodePrinter​(PrintWriter out,
                                String indent)

      Deprecated.

    - #### XmlNodePrinter

          public XmlNodePrinter​(PrintWriter out,
                                String indent,
                                String quote)

      Deprecated.

    - #### XmlNodePrinter

          public XmlNodePrinter​(IndentPrinter out)

      Deprecated.

    - #### XmlNodePrinter

          public XmlNodePrinter​(IndentPrinter out,
                                String quote)

      Deprecated.

    - #### XmlNodePrinter

          public XmlNodePrinter()

      Deprecated.

  - ### Method Detail

    - #### print

          public void print​(Node node)

      Deprecated.

    - #### isNamespaceAware

          public boolean isNamespaceAware()

      Deprecated.
      Check if namespace handling is enabled. Defaults to `true`.
      Returns:
        true if namespace handling is enabled

    - #### setNamespaceAware

          public void setNamespaceAware​(boolean namespaceAware)

      Deprecated.
      Enable and/or disable namespace handling.
      Parameters:
        `namespaceAware` - the new desired value

    - #### isPreserveWhitespace

          public boolean isPreserveWhitespace()

      Deprecated.
      Check if whitespace preservation is enabled. Defaults to `false`.
      Returns:
        true if whitespaces are honoured when printing simple text nodes

    - #### setPreserveWhitespace

          public void setPreserveWhitespace​(boolean preserveWhitespace)

      Deprecated.
      Enable and/or disable preservation of whitespace.
      Parameters:
        `preserveWhitespace` - the new desired value

    - #### getQuote

          public String getQuote()

      Deprecated.
      Get Quote to use when printing attributes.
      Returns:
        the quote character

    - #### setQuote

          public void setQuote​(String quote)

      Deprecated.
      Set Quote to use when printing attributes.
      Parameters:
        `quote` - the quote character

    - #### isExpandEmptyElements

          public boolean isExpandEmptyElements()

      Deprecated.
      Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
      Returns:
        `true`, if empty elements will be represented by an opening tag followed immediately by a closing tag.

    - #### setExpandEmptyElements

          public void setExpandEmptyElements​(boolean expandEmptyElements)

      Deprecated.
      Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
      Parameters:
        `expandEmptyElements` - if `true`, empty elements will be represented by an opening tag followed immediately by a closing tag. Defaults to `false`.

    - #### print

          protected void print​(Node node,
                               XmlNodePrinter.NamespaceContext ctx)

      Deprecated.

    - #### printLineBegin

          protected void printLineBegin()

      Deprecated.

    - #### printLineEnd

          protected void printLineEnd()

      Deprecated.

    - #### printLineEnd

          protected void printLineEnd​(String comment)

      Deprecated.

    - #### printList

          protected void printList​(List list,
                                   XmlNodePrinter.NamespaceContext ctx)

      Deprecated.

    - #### printSimpleItem

          protected void printSimpleItem​(Object value)

      Deprecated.

    - #### printName

          protected void printName​(Node node,
                                   XmlNodePrinter.NamespaceContext ctx,
                                   boolean begin,
                                   boolean preserve)

      Deprecated.

    - #### printSpecialNode

          protected boolean printSpecialNode​(Node node)

      Deprecated.

    - #### printNamespace

          protected void printNamespace​(Object object,
                                        XmlNodePrinter.NamespaceContext ctx)

      Deprecated.

    - #### printNameAttributes

          protected void printNameAttributes​(Map attributes,
                                             XmlNodePrinter.NamespaceContext ctx)

      Deprecated.