com.opensymphony.xwork2.util

## Class DomHelper.DOMBuilder

- java.lang.Object
- - com.opensymphony.xwork2.util.DomHelper.DOMBuilder

- All Implemented Interfaces:
    ContentHandler
  Enclosing class:
    DomHelper

      public static class DomHelper.DOMBuilder
      extends Object
      implements ContentHandler

  The `DOMBuilder` is a utility class that will generate a W3C DOM Document from SAX events.
  Author:
    Carsten Ziegeler

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SAXTransformerFactory` | `factory` The transformer factory
    `protected static SAXTransformerFactory` | `FACTORY` The default transformer factory shared by all instances
    `protected ContentHandler` | `nextHandler`
    `protected Node` | `parentNode` The parentNode
    `protected DOMResult` | `result` The result

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DOMBuilder()` Construct a new instance of this DOMBuilder.
    `DOMBuilder(Node parentNode)` Constructs a new instance that appends nodes to the given parent node.
    `DOMBuilder(SAXTransformerFactory factory)` Construct a new instance of this DOMBuilder.
    `DOMBuilder(SAXTransformerFactory factory, Node parentNode)` Construct a new instance of this DOMBuilder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(char[] arg0, int arg1, int arg2)`
    `void` | `endDocument()`
    `void` | `endElement(String arg0, String arg1, String arg2)`
    `void` | `endPrefixMapping(String arg0)`
    `Document` | `getDocument()` Return the newly built Document.
    `void` | `ignorableWhitespace(char[] arg0, int arg1, int arg2)`
    `void` | `processingInstruction(String arg0, String arg1)`
    `void` | `setDocumentLocator(Locator locator)`
    `void` | `skippedEntity(String arg0)`
    `void` | `startDocument()`
    `void` | `startElement(String uri, String loc, String raw, Attributes attrs)`
    `void` | `startPrefixMapping(String arg0, String arg1)`

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

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

- - ### Field Detail

    - #### FACTORY

          protected static SAXTransformerFactory FACTORY

      The default transformer factory shared by all instances

    - #### factory

          protected SAXTransformerFactory factory

      The transformer factory

    - #### result

          protected DOMResult result

      The result

    - #### parentNode

          protected Node parentNode

      The parentNode

    - #### nextHandler

          protected ContentHandler nextHandler

  - ### Constructor Detail

    - #### DOMBuilder

          public DOMBuilder()

      Construct a new instance of this DOMBuilder.

    - #### DOMBuilder

          public DOMBuilder(SAXTransformerFactory factory)

      Construct a new instance of this DOMBuilder.
      Parameters:
        `factory` - the SAX transformer factory

    - #### DOMBuilder

          public DOMBuilder(Node parentNode)

      Constructs a new instance that appends nodes to the given parent node.
      Parameters:
        `parentNode` - the parent node

    - #### DOMBuilder

          public DOMBuilder(SAXTransformerFactory factory,
                            Node parentNode)

      Construct a new instance of this DOMBuilder.
      Parameters:
        `factory` - the SAX transformer factory
        `parentNode` - the parent node

  - ### Method Detail

    - #### getDocument

          public Document getDocument()

      Return the newly built Document.
      Returns:
        the W3C Document

    - #### setDocumentLocator

          public void setDocumentLocator(Locator locator)

      Specified by:
        `setDocumentLocator` in interface `ContentHandler`

    - #### startDocument

          public void startDocument()
                             throws SAXException

      Specified by:
        `startDocument` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### endDocument

          public void endDocument()
                           throws SAXException

      Specified by:
        `endDocument` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### startElement

          public void startElement(String uri,
                                   String loc,
                                   String raw,
                                   Attributes attrs)
                            throws SAXException

      Specified by:
        `startElement` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### endElement

          public void endElement(String arg0,
                                 String arg1,
                                 String arg2)
                          throws SAXException

      Specified by:
        `endElement` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### startPrefixMapping

          public void startPrefixMapping(String arg0,
                                         String arg1)
                                  throws SAXException

      Specified by:
        `startPrefixMapping` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### endPrefixMapping

          public void endPrefixMapping(String arg0)
                                throws SAXException

      Specified by:
        `endPrefixMapping` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### characters

          public void characters(char[] arg0,
                                 int arg1,
                                 int arg2)
                          throws SAXException

      Specified by:
        `characters` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### ignorableWhitespace

          public void ignorableWhitespace(char[] arg0,
                                          int arg1,
                                          int arg2)
                                   throws SAXException

      Specified by:
        `ignorableWhitespace` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### processingInstruction

          public void processingInstruction(String arg0,
                                            String arg1)
                                     throws SAXException

      Specified by:
        `processingInstruction` in interface `ContentHandler`
      Throws:
        `SAXException`

    - #### skippedEntity

          public void skippedEntity(String arg0)
                             throws SAXException

      Specified by:
        `skippedEntity` in interface `ContentHandler`
      Throws:
        `SAXException`

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.