DomUtil (Apache Tomcat 7.0.104 API Documentation)

org.apache.tomcat.util

## Class DomUtil

- java.lang.Object
- - org.apache.tomcat.util.DomUtil

- Deprecated.
  Unused: Will be removed in Tomcat 8.0.x

      @Deprecated
      public class DomUtil
      extends Object

  Few simple utils to read DOM
  Author:
    Costin Manolache

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DomUtil.NullResolver` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DomUtil()` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Node` | `findChildWithAtt(Node parent, String elemName, String attName, String attVal)` Deprecated. Find the first direct child with a given attribute.
    `static String` | `getAttribute(Node element, String attName)` Deprecated.
    `static Node` | `getChild(Node parent, int type)` Deprecated. Get the first direct child with a given type
    `static Node` | `getChild(Node parent, String name)` Deprecated. Get the first element child.
    `static String` | `getChildContent(Node parent, String name)` Deprecated. Get the first child's content ( ie it's included TEXT node ).
    `static String` | `getContent(Node n)` Deprecated. Get the trimmed text content of a node or null if there is no text
    `static Node` | `getNext(Node current)` Deprecated. Get the next sibling with the same name and type
    `static Node` | `getNext(Node current, String name, int type)` Deprecated. Return the next sibling with a given name and type
    `static Document` | `readXml(InputStream is)` Deprecated. Read XML as DOM.
    `static void` | `removeAttribute(Node node, String attName)` Deprecated.
    `static void` | `setAttribute(Node node, String attName, String val)` Deprecated.
    `static void` | `setAttributes(Object o, Node parent)` Deprecated.
    `static void` | `setText(Node node, String val)` Deprecated. Set or replace the text value
    `static void` | `writeXml(Node n, OutputStream os)` Deprecated.

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

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

- - ### Constructor Detail

    - #### DomUtil

          public DomUtil()

      Deprecated.

  - ### Method Detail

    - #### getContent

          public static String getContent(Node n)

      Deprecated.
      Get the trimmed text content of a node or null if there is no text

    - #### getChild

          public static Node getChild(Node parent,
                      String name)

      Deprecated.
      Get the first element child.
      Parameters:
        `parent` - lookup direct children
        `name` - name of the element. If null return the first element.

    - #### getAttribute

          public static String getAttribute(Node element,
                            String attName)

      Deprecated.

    - #### setAttribute

          public static void setAttribute(Node node,
                          String attName,
                          String val)

      Deprecated.

    - #### removeAttribute

          public static void removeAttribute(Node node,
                             String attName)

      Deprecated.

    - #### setText

          public static void setText(Node node,
                     String val)

      Deprecated.
      Set or replace the text value

    - #### findChildWithAtt

          public static Node findChildWithAtt(Node parent,
                              String elemName,
                              String attName,
                              String attVal)

      Deprecated.
      Find the first direct child with a given attribute.
      Parameters:
        `parent` -
        `elemName` - name of the element, or null for any
        `attName` - attribute we're looking for
        `attVal` - attribute value or null if we just want any

    - #### getChildContent

          public static String getChildContent(Node parent,
                               String name)

      Deprecated.
      Get the first child's content ( ie it's included TEXT node ).

    - #### getChild

          public static Node getChild(Node parent,
                      int type)

      Deprecated.
      Get the first direct child with a given type

    - #### getNext

          public static Node getNext(Node current)

      Deprecated.
      Get the next sibling with the same name and type

    - #### getNext

          public static Node getNext(Node current,
                     String name,
                     int type)

      Deprecated.
      Return the next sibling with a given name and type

    - #### setAttributes

          public static void setAttributes(Object o,
                           Node parent)

      Deprecated.

    - #### readXml

          public static Document readXml(InputStream is)
                                  throws SAXException,
                                         IOException,
                                         ParserConfigurationException

      Deprecated.
      Read XML as DOM.
      Throws:
        `SAXException`
        `IOException`
        `ParserConfigurationException`

    - #### writeXml

          public static void writeXml(Node n,
                      OutputStream os)
                               throws TransformerException

      Deprecated.
      Throws:
        `TransformerException`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.