public class DOMUtils
extends java.lang.Object
In this documentation <a>
means an Element
instance with name a
.
Constructor and Description |
---|
DOMUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
appendCDATA(org.w3c.dom.Element parent,
java.lang.String content)
Adds a nested CDATA section.
|
static void |
appendCDATAElement(org.w3c.dom.Element parent,
java.lang.String name,
java.lang.String content)
Adds a nested CDATA section in a new child element.
|
static void |
appendText(org.w3c.dom.Element parent,
java.lang.String content)
Adds nested text.
|
static void |
appendTextElement(org.w3c.dom.Element parent,
java.lang.String name,
java.lang.String content)
Adds nested text in a new child element.
|
static org.w3c.dom.Element |
createChildElement(org.w3c.dom.Element parent,
java.lang.String name)
Creates a named Element and appends it to the given element,
returns it.
|
static org.w3c.dom.Document |
newDocument()
Get a new Document instance,
|
public static org.w3c.dom.Document newDocument()
public static org.w3c.dom.Element createChildElement(org.w3c.dom.Element parent, java.lang.String name)
This means
createChildElement(<a>, "b")creates
<a> <b/> </a>and returns
<b>
.parent
- element that will receive the new element as child.name
- name of the new element.public static void appendText(org.w3c.dom.Element parent, java.lang.String content)
This means
appendText(<a>, "b")creates
<a>b</a>
parent
- element that will receive the new element as child.content
- text content.public static void appendCDATA(org.w3c.dom.Element parent, java.lang.String content)
This means
appendCDATA(<a>, "b")creates
<a><[!CDATA[b]]></a>
parent
- element that will receive the new element as child.content
- text content.public static void appendTextElement(org.w3c.dom.Element parent, java.lang.String name, java.lang.String content)
This means
appendTextElement(<a>, "b", "c")creates
<a> <b>c</b> </a>
parent
- element that will receive the new element as child.name
- of the child element.content
- text content.public static void appendCDATAElement(org.w3c.dom.Element parent, java.lang.String name, java.lang.String content)
This means
appendCDATAElement(<a>, "b", "c")creates
<a> <b><![CDATA[c]]></b> </a>
parent
- element that will receive the new element as child.name
- of the child element.content
- text content.