org.openbp.common.markup
Class DOMFactory

java.lang.Object
  extended by org.openbp.common.markup.DOMFactory

public class DOMFactory
extends java.lang.Object

Factory class that supports the creation of DOM trees.


Constructor Summary
DOMFactory()
          Constructor for a new, empty document.
DOMFactory(java.lang.String rootTag)
          Constructor that specifies the name of the root node.
 
Method Summary
 org.w3c.dom.Element createElement(org.w3c.dom.Element parent, java.lang.String nodeName)
          Creates an empty element and adds that to the parent element.
 org.w3c.dom.Element createElement(java.lang.String nodeName)
          Creates an empty element.
 org.w3c.dom.Element createTextNode(org.w3c.dom.Element parent, java.lang.String nodeName, java.lang.String value)
          Creates an element containing a string value and adds it to a parent element.
 org.w3c.dom.Element createTextNode(java.lang.String nodeName, boolean value)
          Generates a XML text node from boolean.
 org.w3c.dom.Element createTextNode(java.lang.String nodeName, int value)
          Generates a XML text node from String.
 org.w3c.dom.Element createTextNode(java.lang.String nodeName, java.lang.Integer value)
          Generates a XML text node from String.
 org.w3c.dom.Element createTextNode(java.lang.String nodeName, java.lang.String value)
          Generates a XML text node from String.
 org.w3c.dom.Element createTextOrEmptyNode(org.w3c.dom.Element parent, java.lang.String nodeName, java.lang.String value)
          Creates an element containing a string value and adds it to a parent element.
 org.w3c.dom.Document getDocument()
          Gets the document instance this factory operates on.
 org.w3c.dom.Element getRootElement()
          Gets the root element of the DOM tree.
 void setDocument(org.w3c.dom.Document doc)
          Sets the document instance this factory operates on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMFactory

public DOMFactory()
Constructor for a new, empty document.


DOMFactory

public DOMFactory(java.lang.String rootTag)
Constructor that specifies the name of the root node.

Parameters:
rootTag - Name of the root tag
Method Detail

getDocument

public org.w3c.dom.Document getDocument()
Gets the document instance this factory operates on.


setDocument

public void setDocument(org.w3c.dom.Document doc)
Sets the document instance this factory operates on.


getRootElement

public org.w3c.dom.Element getRootElement()
Gets the root element of the DOM tree.


createTextOrEmptyNode

public org.w3c.dom.Element createTextOrEmptyNode(org.w3c.dom.Element parent,
                                                 java.lang.String nodeName,
                                                 java.lang.String value)
Creates an element containing a string value and adds it to a parent element. In contrast to the other createTextNode methods, this method generates also a empty tag.

Parameters:
parent - Parent element the new element shall be linked to or null
nodeName - Name of the element
value - Value of the element or null
Returns:
The element

createTextNode

public org.w3c.dom.Element createTextNode(org.w3c.dom.Element parent,
                                          java.lang.String nodeName,
                                          java.lang.String value)
Creates an element containing a string value and adds it to a parent element.

Parameters:
parent - Parent element the new element shall be linked to or null
nodeName - Name of the element
value - Value of the element or null
Returns:
The element or null if the value is null

createTextNode

public org.w3c.dom.Element createTextNode(java.lang.String nodeName,
                                          java.lang.String value)
Generates a XML text node from String.

Parameters:
nodeName - Name of the element
value - Value of the element
Returns:
The element or null if the value is null

createTextNode

public org.w3c.dom.Element createTextNode(java.lang.String nodeName,
                                          int value)
Generates a XML text node from String.

Parameters:
nodeName - Name of the element
value - Value of the element
Returns:
The element or null if the value is null

createTextNode

public org.w3c.dom.Element createTextNode(java.lang.String nodeName,
                                          java.lang.Integer value)
Generates a XML text node from String.

Parameters:
nodeName - Name of the element
value - Value of the element
Returns:
The element or null if the value is null

createTextNode

public org.w3c.dom.Element createTextNode(java.lang.String nodeName,
                                          boolean value)
Generates a XML text node from boolean.

Parameters:
nodeName - Name of the element
value - Value of the element
Returns:
The element or null if the value is null

createElement

public org.w3c.dom.Element createElement(java.lang.String nodeName)
Creates an empty element.

Parameters:
nodeName - Name of the element
Returns:
The element

createElement

public org.w3c.dom.Element createElement(org.w3c.dom.Element parent,
                                         java.lang.String nodeName)
Creates an empty element and adds that to the parent element.

Parameters:
parent - The parent element
nodeName - Name of the element
Returns:
The element


Copyright © 2011. All Rights Reserved.