|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ibisph.util.XMLLib
public abstract class XMLLib
XML helper methods to create and manipulate XML Documents and Elements.
| Constructor Summary | |
|---|---|
XMLLib()
|
|
| Method Summary | |
|---|---|
static void |
addElement(org.dom4j.Document document,
java.lang.String parentElementXPath,
org.dom4j.Element element)
Adds the passed element to the container using an XPath expression to select the parent container of where to add the element to. |
static boolean |
deleteNode(org.dom4j.Node node)
Simple helper that provides a localized way to delete a single node. |
static boolean |
deleteNodes(java.util.List nodeList)
Simple helper that provides a localized way to delete a node list. |
static org.dom4j.Node |
getNode(org.dom4j.Node currentNode,
java.lang.String xPath)
Simple helper that provides a localized way to get a node via an XPath expression. |
static java.lang.String |
getText(org.dom4j.Document document,
java.lang.String xPath)
Simple overloaded helper that provides a localized way to get a document's text via an XPath expression. |
static java.lang.String |
getText(org.dom4j.Document document,
java.lang.String xPath,
java.lang.String defaultValue)
Simple overloaded helper that provides a localized way to get a document's text via an XPath expression with a default fall back value. |
static java.lang.String |
getText(org.dom4j.Element element,
java.lang.String xPath)
Simple overloaded helper that provides a localized way to get an element's text via an XPath expression. |
static java.lang.String |
getText(org.dom4j.Element element,
java.lang.String xPath,
java.lang.String defaultValue)
Simple overloaded helper that provides a localized way to get an element's text via an XPath expression with a default fall back value. |
static org.dom4j.Element |
newCDATAElement(java.lang.String elementName,
java.lang.String text)
Creates a new CDATA element and sets the text as CDATA. |
static org.dom4j.Document |
newDocument()
|
static org.dom4j.Document |
newDocument(java.lang.String rootElementName)
Creates a new document with a root element. |
static org.dom4j.Element |
newElement(java.lang.String elementName)
Creates a new element. |
static org.dom4j.Element |
newElement(java.lang.String elementName,
java.lang.Object object)
Creates a new element and sets the element's text to the
object.toString. |
static org.dom4j.Element |
newElement(java.lang.String elementName,
java.lang.String textValue)
Creates a new element and sets the element's text to the textValue. |
static void |
setElement(org.dom4j.Document document,
java.lang.String parentElementXPath,
org.dom4j.Element element)
Selects a parent container element and sets the passed element to the container. |
static void |
setElementCDATAText(org.dom4j.Document document,
java.lang.String parentElementXPath,
java.lang.String elementName,
java.lang.String text)
Sets/replaces the existing element with a new CDATA text element. |
static void |
setElementText(org.dom4j.Document document,
java.lang.String parentElementXPath,
java.lang.String elementName,
java.lang.String text)
Sets an element's text with the new text. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLLib()
| Method Detail |
|---|
public static org.dom4j.Document newDocument()
public static org.dom4j.Document newDocument(java.lang.String rootElementName)
rootElementName - Name of the root element.
rootElementName.public static org.dom4j.Element newElement(java.lang.String elementName)
elementName - Name of the element to be created.
elementName.
public static org.dom4j.Element newElement(java.lang.String elementName,
java.lang.Object object)
object.toString.
elementName - Name of the element to be created.object - Object who's text will be added to the element's text.
elementName containing the
object's text.
public static org.dom4j.Element newElement(java.lang.String elementName,
java.lang.String textValue)
elementName - Name of the element to be created.textValue - Text that will be added to the element's text.
elementName containing the
textValue.
public static org.dom4j.Element newCDATAElement(java.lang.String elementName,
java.lang.String text)
elementName - Name of the element to be created.text - Text that will be added to the element's CDATA text.
elementName containing the
text.
public static org.dom4j.Node getNode(org.dom4j.Node currentNode,
java.lang.String xPath)
currentNode - Document/element/node to retrieve node from.xPath - Text that contains an XPath expression to be used to
select/specify the desired node.
public static java.lang.String getText(org.dom4j.Document document,
java.lang.String xPath,
java.lang.String defaultValue)
document - Document to retrieve node's text from.xPath - Text that contains an XPath expression to be used to
select/specify the desired node's text.defaultValue - Value returned if the XPath expression returns a
null result.
public static java.lang.String getText(org.dom4j.Document document,
java.lang.String xPath)
document - Document to retrieve node's text from.xPath - Text that contains an XPath expression to be used to
select/specify the desired node's text.
public static java.lang.String getText(org.dom4j.Element element,
java.lang.String xPath,
java.lang.String defaultValue)
element - element to retrieve node's text from.xPath - Text that contains an XPath expression to be used to
select/specify the desired node's text.defaultValue - Value returned if the XPath expression returns a
null result.
public static java.lang.String getText(org.dom4j.Element element,
java.lang.String xPath)
element - element to retrieve node's text from.xPath - Text that contains an XPath expression to be used to
select/specify the desired node's text.
public static boolean deleteNode(org.dom4j.Node node)
node - node to be deleted.
true if node was successfully detached, otherwise
false.public static boolean deleteNodes(java.util.List nodeList)
nodeList - List of nodes to be deleted.
true if nodes were successfully detached, otherwise
false.
public static void addElement(org.dom4j.Document document,
java.lang.String parentElementXPath,
org.dom4j.Element element)
document - Source to add the element to.parentElementXPath - XPath that selects the parent container to have
the element added to.element - Actual element to add into the document.
public static void setElement(org.dom4j.Document document,
java.lang.String parentElementXPath,
org.dom4j.Element element)
document - Source to add the element to.parentElementXPath - XPath that selects the parent container to have
the element added to.element - Actual element to add into the document.
public static void setElementCDATAText(org.dom4j.Document document,
java.lang.String parentElementXPath,
java.lang.String elementName,
java.lang.String text)
document - Source to add the element to.parentElementXPath - XPath that selects the parent container to have
the element added to.elementName - Name of the element to be added.text - Value to set within the element as CDATA.
public static void setElementText(org.dom4j.Document document,
java.lang.String parentElementXPath,
java.lang.String elementName,
java.lang.String text)
document - Source to add the element to.parentElementXPath - XPath that selects the parent container to have
the element added to.elementName - Name of the element to have its text set.text - Value to set the element's text to.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||