public class DOMUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DOMUtil.NodeListImpl
NodeListImpl.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
NS_URI_XMLNS
The namespaceURI represented by the prefix
xmlns. |
static DOMUtil |
UTIL
static object to access the methods of this object.
|
| Constructor and Description |
|---|
DOMUtil()
Creates a new instance of DOMUtil.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areElementsEqual(File file1,
File file2,
String xpathExp)
This method is used to check if the value of the an element is same in the
both of the documents provided.
|
String |
DOM2String(Document aDocument,
Writer aWriter)
save document to stream.
|
String |
elementToString(Element element)
Convert an element to String
|
String |
getAttribute(Element aElement,
String aAttribute)
get attribute
|
String |
getAttribute(Element aElement,
String aAttribute,
String aPrefix)
get attribute
|
NodeList |
getChildElements(Element aElement,
String aElementTagName)
get the children of the same type element tag name.
|
Element |
getElement(Document aParentDocument,
String aTagName)
gets the element.
|
Element |
getElement(Element elem,
String tagName)
gets the element.
|
String |
getElementName(Element aElement)
get Element Tag Name with striped prefix.
|
NodeList |
getElements(Document aParentDocument,
String aTagName)
gets set of elements.
|
NodeList |
getElements(Element aParentElement,
String aTagName)
gets list of elements.
|
String |
getElementValue(Document doc,
String elemName)
gets the element value.
|
String |
getLocalName(String qname)
Gets the local name from the quname.
|
String |
getName(String aName)
strips the prefix of the name if present.
|
String |
getName(String aName,
String aPrefix)
adds the prefix to the name
|
String |
getNamespace(Element el,
String qname)
Gets the namespace from the qname.
|
QName |
getQualifiedAttributeValue(Element el,
String attrName)
use this util method to retrieve a QName in a attribute.
|
String |
getTextData(Element aElement)
use this util method to retrieve a Text Data in a element.
|
void |
setTextData(Element aElement,
String aData)
use this util method to set a Text Data in a element.
|
public static final DOMUtil UTIL
public static final String NS_URI_XMLNS
xmlns.public Element getElement(Document aParentDocument, String aTagName)
aParentDocument - Document for parent nodeaTagName - String for tagnamepublic Element getElement(Element elem, String tagName)
elem - Element for parent nodetagName - String for tagnamepublic String getElementValue(Document doc, String elemName)
doc - Document for parent nodeelemName - String for element namepublic String getAttribute(Element aElement, String aAttribute, String aPrefix)
aElement - Element objectaAttribute - String value of attributeaPrefix - String value of prefixpublic String getAttribute(Element aElement, String aAttribute)
aElement - Element objectaAttribute - String value of attributepublic void setTextData(Element aElement, String aData)
aElement - Element for text nodeaData - String contains textpublic String getTextData(Element aElement)
aElement - Element for text nodepublic String getLocalName(String qname)
qname - Qualified name of service.public String getNamespace(Element el, String qname)
qname - Qname of servicepublic QName getQualifiedAttributeValue(Element el, String attrName) throws IllegalArgumentException
aElement - Element containing the attributeattrName - attribute nameIllegalArgumentExceptionpublic String DOM2String(Document aDocument, Writer aWriter) throws Exception
aDocument - DocumentaWriter - is what the aDocument is serialized to.Exception - If fails to construct a string.public String elementToString(Element element) throws Exception
element - - the element to convert to StringExceptionpublic NodeList getElements(Element aParentElement, String aTagName)
aParentElement - Element for parentaTagName - String for tagnamepublic NodeList getElements(Document aParentDocument, String aTagName)
aParentDocument - Document for parent nodeaTagName - String for tagnamepublic NodeList getChildElements(Element aElement, String aElementTagName)
aElement - Element for parent nodeaElementTagName - String for tagnamepublic String getElementName(Element aElement)
aElement - Element objectpublic String getName(String aName)
aName - String value of Name with prefixpublic String getName(String aName, String aPrefix)
aName - String value of Name with prefixaPrefix - String value of prefixpublic static boolean areElementsEqual(File file1, File file2, String xpathExp) throws ManagementException
file1 - that contains a descriptorfile2 - that contains the other descriptorelementName - the element nameManagementException - if there are problems in comparing the documentsCopyright © 2011-2016 OpenESB Community. All Rights Reserved.