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

## edu.emory.mathcs.util.xml
Class DOMUtils

    java.lang.Object
      edu.emory.mathcs.util.xml.DOMUtils

public class DOMUtils
extends java.lang.Object

Set of lightweight utility methods to simplify XML parsing with DOM, if one does not want to use JAXB or other large libraries.

Version:
  1.0
Author:
  Dawid Kurzyniec

Method Summary
`static org.w3c.dom.Element` | `createChildElement(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.String name)`
`static javax.xml.parsers.DocumentBuilder` | `createDocumentBuilder()`
`static javax.xml.parsers.DocumentBuilder` | `createDocumentBuilder(boolean validating, boolean namespaceAware)`
`static javax.xml.parsers.DocumentBuilder` | `createDocumentBuilder(boolean validating, boolean namespaceAware, boolean ignoringElementContentWhitespace, boolean ignoringComments)`
`static javax.xml.parsers.DocumentBuilder` | `createDocumentBuilder(boolean validating, boolean namespaceAware, boolean ignoringElementContentWhitespace, boolean ignoringComments, boolean expandEntityReferences, boolean coalescing)`
`static org.w3c.dom.Text` | `createTextChildElement(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.String name, java.lang.String text)`
`static org.w3c.dom.Text` | `createTextNode(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.String text)`
`static java.lang.String` | `getAttribute(org.w3c.dom.Element element, java.lang.String name)`
`static java.lang.String` | `getAttribute(org.w3c.dom.Element element, java.lang.String name, java.lang.String defVal)`
`static org.w3c.dom.Element` | `getChildElement(org.w3c.dom.Element element, java.lang.String name)`
`static org.w3c.dom.Element` | `getChildElement(org.w3c.dom.Element element, java.lang.String name, org.w3c.dom.Node initPos)`
`static org.w3c.dom.Element[]` | `getChildElements(org.w3c.dom.Element element)`
`static java.lang.String` | `getText(org.w3c.dom.Element element)` Assuming that this element has no subelements, retrieve its textual content
`static void` | `setAttribute(org.w3c.dom.Element element, java.lang.String name, java.lang.String val)`

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

Method Detail

### createDocumentBuilder

    public static javax.xml.parsers.DocumentBuilder createDocumentBuilder()

### createDocumentBuilder

    public static javax.xml.parsers.DocumentBuilder createDocumentBuilder(boolean validating,
                                                                          boolean namespaceAware)

### createDocumentBuilder

    public static javax.xml.parsers.DocumentBuilder createDocumentBuilder(boolean validating,
                                                                          boolean namespaceAware,
                                                                          boolean ignoringElementContentWhitespace,
                                                                          boolean ignoringComments)

### createDocumentBuilder

    public static javax.xml.parsers.DocumentBuilder createDocumentBuilder(boolean validating,
                                                                          boolean namespaceAware,
                                                                          boolean ignoringElementContentWhitespace,
                                                                          boolean ignoringComments,
                                                                          boolean expandEntityReferences,
                                                                          boolean coalescing)

### getAttribute

    public static java.lang.String getAttribute(org.w3c.dom.Element element,
                                                java.lang.String name)

### getAttribute

    public static java.lang.String getAttribute(org.w3c.dom.Element element,
                                                java.lang.String name,
                                                java.lang.String defVal)

### setAttribute

    public static void setAttribute(org.w3c.dom.Element element,
                                    java.lang.String name,
                                    java.lang.String val)

### getChildElements

    public static org.w3c.dom.Element[] getChildElements(org.w3c.dom.Element element)

### createChildElement

    public static org.w3c.dom.Element createChildElement(org.w3c.dom.Document doc,
                                                         org.w3c.dom.Element parent,
                                                         java.lang.String name)

### createTextNode

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

### createTextChildElement

    public static org.w3c.dom.Text createTextChildElement(org.w3c.dom.Document doc,
                                                          org.w3c.dom.Element parent,
                                                          java.lang.String name,
                                                          java.lang.String text)

### getChildElement

    public static org.w3c.dom.Element getChildElement(org.w3c.dom.Element element,
                                                      java.lang.String name)

### getChildElement

    public static org.w3c.dom.Element getChildElement(org.w3c.dom.Element element,
                                                      java.lang.String name,
                                                      org.w3c.dom.Node initPos)

### getText

    public static java.lang.String getText(org.w3c.dom.Element element)

  Assuming that this element has no subelements, retrieve its textual content

  To Do:
    Unsure if the approach is correct

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