public class DOMUtils extends 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,
String content)
Adds a nested CDATA section.
|
static void |
appendCDATAElement(org.w3c.dom.Element parent,
String name,
String content)
Adds a nested CDATA section in a new child element.
|
static void |
appendText(org.w3c.dom.Element parent,
String content)
Adds nested text.
|
static void |
appendTextElement(org.w3c.dom.Element parent,
String name,
String content)
Adds nested text in a new child element.
|
static org.w3c.dom.Element |
createChildElement(org.w3c.dom.Element parent,
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 void appendCDATA(org.w3c.dom.Element parent, 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 appendCDATAElement(org.w3c.dom.Element parent, String name, 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.public static void appendText(org.w3c.dom.Element parent, 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 appendTextElement(org.w3c.dom.Element parent, String name, 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 org.w3c.dom.Element createChildElement(org.w3c.dom.Element parent, 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 org.w3c.dom.Document newDocument()