public class XMLHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright
|
static java.lang.String |
TEXT_AMPERSAND
Ampersand in XML presentation.
|
static java.lang.String |
TEXT_DOUBLE_QUOTE
Double quote in XML presentation
|
static java.lang.String |
TEXT_DOUBLE_QUOTE_FOR_BLAZE
Double quote for XML presentation and Blaze presentation.
|
static java.lang.String |
TEXT_LEFT_ANGLE_BRACKET
Left angle bracket in XML presentation.
|
static java.lang.String |
TEXT_RIGHT_ANGLE_BRACKET
Right angle bracket in XML presentation.
|
static java.lang.String |
TEXT_SINGLE_QUOTE
Single quote in XML presentation.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
beginTag(java.lang.String tagName,
java.lang.String[] attributes,
java.lang.String[] values)
Constructs the beginning tag of an XML Element
|
static java.lang.String |
endTag(java.lang.String tagName)
Return the end tag of one XML element
|
static java.lang.String |
formatToXMLCompatibleData(java.lang.String text)
Replaces illegal characters with entity references in XML, which include "&", "<", ">", "'" and """
|
static java.lang.String |
getAttributeValue(org.w3c.dom.Node node,
java.lang.String name)
Returns the value of an attribute
|
static org.w3c.dom.Node |
getChildElementByName(org.w3c.dom.Node node,
java.lang.String name)
Returns a child element of current node
|
static java.lang.String |
getChildElementValue(org.w3c.dom.Element thisNode,
java.lang.String childName)
Helps to find the string value of a Child XML element
|
static java.lang.String |
getChildElementValue(org.w3c.dom.Node thisNode,
java.lang.String childName)
Returns the value of the child element identified by childName parameter
|
static javax.xml.parsers.DocumentBuilder |
getDocumentBuilder()
Obtains a non-validating document builder for serial re-use by the current thread.
|
static java.util.Vector |
getElementTextValue(org.w3c.dom.Node node,
java.lang.String elementTagName)
This method will return a vector of all possible text values which match the given element tag
name in the Node Object.
|
static java.lang.String |
getElementValue(org.w3c.dom.Node node)
Returns the value of the current element.
|
static org.w3c.dom.Document |
getXMLDocument(java.lang.String xmlString)
Generator the XML Document object based on the XML String input.
|
static XMLizable |
initializeXMLizableObject(org.w3c.dom.Node node)
Initializes XMLizable object based on the
"impl" attribute |
static java.lang.String |
simpleValueTag(java.lang.String tag,
java.lang.String value)
Returns an enclosed tag String.
|
static java.lang.String |
startTag(java.lang.String tagName)
Return the start tag of one XML element.
|
static java.lang.String |
startTag(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue)
Return the start tag with one attribute.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String TEXT_AMPERSAND
public static final java.lang.String TEXT_DOUBLE_QUOTE
public static final java.lang.String TEXT_DOUBLE_QUOTE_FOR_BLAZE
public static final java.lang.String TEXT_LEFT_ANGLE_BRACKET
public static final java.lang.String TEXT_RIGHT_ANGLE_BRACKET
public static final java.lang.String TEXT_SINGLE_QUOTE
public static java.lang.String startTag(java.lang.String tagName)
tagName
- is the name of tag.public static java.lang.String startTag(java.lang.String tagName, java.lang.String attributeName, java.lang.String attributeValue)
tagName
- is a tag name.attributeName
- is the attribute name.attributeValue
- is the attribute value.public static java.lang.String endTag(java.lang.String tagName)
tagName
- is the name of tagpublic static java.lang.String getChildElementValue(org.w3c.dom.Element thisNode, java.lang.String childName)
thisNode
- Node the parent nodechildName
- String the name of the child elementpublic static java.lang.String getChildElementValue(org.w3c.dom.Node thisNode, java.lang.String childName)
thisNode
- the current XML nodechildName
- the name of the child elementpublic static java.util.Vector getElementTextValue(org.w3c.dom.Node node, java.lang.String elementTagName)
node
- is the current XML node.elementTagName
- is the name of element tag in string format.public static java.lang.String beginTag(java.lang.String tagName, java.lang.String[] attributes, java.lang.String[] values)
tagName
- String name of the tagattributes
- String attribute namesvalues
- String attribute valuespublic static final javax.xml.parsers.DocumentBuilder getDocumentBuilder() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document getXMLDocument(java.lang.String xmlString)
xmlString
- xml string to be built to document.public static java.lang.String getElementValue(org.w3c.dom.Node node)
node
- is the node in a DOM tree.public static java.lang.String getAttributeValue(org.w3c.dom.Node node, java.lang.String name)
node
- is the node in a DOM treename
- name of the attributepublic static org.w3c.dom.Node getChildElementByName(org.w3c.dom.Node node, java.lang.String name)
node
- is the node in a DOM treename
- name of the child elementpublic static java.lang.String simpleValueTag(java.lang.String tag, java.lang.String value)
tag
- name of the tagvalue
- value of the elementpublic static XMLizable initializeXMLizableObject(org.w3c.dom.Node node) throws DeXMLizationException
"impl"
attributenode
- XML node that represent the XML objectDeXMLizationException
- when the DeXMLization fails due to class instantiation problems or DeXMLization problemspublic static java.lang.String formatToXMLCompatibleData(java.lang.String text)
text
- the original text