Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tonbeller.wcf.utils
Class DomUtils

    java.lang.Object
      com.tonbeller.wcf.utils.DomUtils

public class DomUtils
extends java.lang.Object

Constructor Summary
`DomUtils()`

Method Summary
`static org.w3c.dom.Element` | `appendElement(org.w3c.dom.Element parent, java.lang.String type)` creates a new element of type and appends it to parent
`static org.w3c.dom.Text` | `appendNbsp(org.w3c.dom.Element parent)`
`static org.w3c.dom.Text` | `appendText(org.w3c.dom.Element parent, java.lang.String text)`
`static org.w3c.dom.Element` | `findElementWithId(java.lang.String id, org.w3c.dom.Element root)` fast search for Element with id attribute
`static void` | `generateIds(org.w3c.dom.Node root)`
`static void` | `generateIds(org.w3c.dom.Node root, java.lang.String attrName)` adds an attribute with random value to all elements, that do not have an attribute with the specified name.
`static org.w3c.dom.Element` | `getChildElemById(org.w3c.dom.Element parent, java.lang.String id)` returns first child element with fitting id.
`static org.w3c.dom.Element` | `getChildElemByTagName(org.w3c.dom.Element parent, java.lang.String tagName)` returns first child element with fitting tag name.
`static java.util.List` | `getChildElements(org.w3c.dom.Node parent)` returns List of all direct child elements
`static java.util.List` | `getChildElemsByTagName(org.w3c.dom.Element parent, java.lang.String tagName)` returns Vector of all Child elements, specified by tag name.
`static java.util.List` | `getChildNodesExceptAttributes(org.w3c.dom.Node parent)` returns List of all direct child elements exept Attribute nodes.
`static org.w3c.dom.Document` | `getDocument(org.w3c.dom.Node node)` returns the Document. node itself may be a Document node in which case node.getOwnerDocument() will return null
`static java.lang.String` | `randomId()`
`static void` | `removeAttribute(org.w3c.dom.Element elem, java.lang.String name)` Oracle 10i does not allow to remove an attribute that does not exist.
`static void` | `removeChildElements(org.w3c.dom.Element parent)` removes all children of element type
`static void` | `removeChildNodesExceptAttributes(org.w3c.dom.Element parent)` removes all children of element ant text type
`static void` | `setRandomSeed(long seed)`
`static org.w3c.dom.Text` | `setText(org.w3c.dom.Element parent, java.lang.String text)` removes all element/text children, then adds a new single text child

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

Constructor Detail

### DomUtils

    public DomUtils()

Method Detail

### getChildElemsByTagName

    public static java.util.List getChildElemsByTagName(org.w3c.dom.Element parent,
                                                        java.lang.String tagName)

  returns Vector of all Child elements, specified by tag name. same as Element.getElementsByTagName, but not recursive.

### getChildElements

    public static java.util.List getChildElements(org.w3c.dom.Node parent)

  returns List of all direct child elements

### getChildNodesExceptAttributes

    public static java.util.List getChildNodesExceptAttributes(org.w3c.dom.Node parent)

  returns List of all direct child elements exept Attribute nodes. Among others this will contain Element nodes and Text children.

### removeChildElements

    public static void removeChildElements(org.w3c.dom.Element parent)

  removes all children of element type

### removeChildNodesExceptAttributes

    public static void removeChildNodesExceptAttributes(org.w3c.dom.Element parent)

  removes all children of element ant text type

### setText

    public static org.w3c.dom.Text setText(org.w3c.dom.Element parent,
                                           java.lang.String text)

  removes all element/text children, then adds a new single text child

### getChildElemByTagName

    public static org.w3c.dom.Element getChildElemByTagName(org.w3c.dom.Element parent,
                                                            java.lang.String tagName)

  returns first child element with fitting tag name.

### getChildElemById

    public static org.w3c.dom.Element getChildElemById(org.w3c.dom.Element parent,
                                                       java.lang.String id)

  returns first child element with fitting id.

### getDocument

    public static org.w3c.dom.Document getDocument(org.w3c.dom.Node node)

  returns the Document. node itself may be a Document node in which case node.getOwnerDocument() will return null

### appendElement

    public static org.w3c.dom.Element appendElement(org.w3c.dom.Element parent,
                                                    java.lang.String type)

  creates a new element of type and appends it to parent

### appendNbsp

    public static org.w3c.dom.Text appendNbsp(org.w3c.dom.Element parent)

### appendText

    public static org.w3c.dom.Text appendText(org.w3c.dom.Element parent,
                                              java.lang.String text)

### randomId

    public static java.lang.String randomId()

### setRandomSeed

    public static void setRandomSeed(long seed)

### generateIds

    public static void generateIds(org.w3c.dom.Node root,
                                   java.lang.String attrName)

  adds an attribute with random value to all elements, that do not have an attribute with the specified name.

  Parameters:
    `root` - the root element
    `attrName` - the name of the attribute, e.g. "id"

### generateIds

    public static void generateIds(org.w3c.dom.Node root)

### findElementWithId

    public static org.w3c.dom.Element findElementWithId(java.lang.String id,
                                                        org.w3c.dom.Element root)

  fast search for Element with id attribute

  Parameters:
    `root` - the root Element of the search. search will cover root and its descendants
    `id` - the id to search for
  Returns:
    null or the element

### removeAttribute

    public static void removeAttribute(org.w3c.dom.Element elem,
                                       java.lang.String name)

  Oracle 10i does not allow to remove an attribute that does not exist. This method will silently ignore any exceptions that occur while removing the attribute.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD