|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object issrg.utils.xml.XMLUtils
public final class XMLUtils
Class containing utility methods for working with XML documents. Some useful operations which may eliminate certain repetitive constructs from the code are defined.
Method Summary | |
---|---|
static java.util.List<java.util.List<java.lang.String>> |
getAttributeValuesOnChildren(org.w3c.dom.Element element,
java.lang.String childName,
java.lang.Iterable<java.lang.String> attributeNames)
Gets the values of specified attributes on child elements specified by name. |
static java.lang.String[] |
getAttributeValuesOnChildren(org.w3c.dom.Element element,
java.lang.String childName,
java.lang.String attributeName)
Return an array of values of attributes specified by attributeName on all the element children of the Element element that have the name "childName". |
static boolean |
isElement(org.w3c.dom.Node n)
Helper method to test whether a node is an element. |
static void |
setAttributesOnChildElements(org.w3c.dom.Document document,
org.w3c.dom.Element parentElement,
java.lang.String[] attValues,
java.lang.String childElementName,
java.lang.String childAttName)
Sets the values of attributes with name childAttName on child elements of parentElement with name childElementName to values specified in the array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String[] getAttributeValuesOnChildren(org.w3c.dom.Element element, java.lang.String childName, java.lang.String attributeName)
element
- The parent element to searchchildName
- The name of child elements to processattributeName
- The attribute name on a child element to include in the result
public static java.util.List<java.util.List<java.lang.String>> getAttributeValuesOnChildren(org.w3c.dom.Element element, java.lang.String childName, java.lang.Iterable<java.lang.String> attributeNames)
element
- the parent elementchildName
- the name of the child element for which certain attribute values
should be collectedattributeNames
- a List of attribute names
public static void setAttributesOnChildElements(org.w3c.dom.Document document, org.w3c.dom.Element parentElement, java.lang.String[] attValues, java.lang.String childElementName, java.lang.String childAttName)
document
- The Document to which the elements in question belongparentElement
- the element to create child elements onattValues
- the values of the attributeschildElementName
- the name of child elements to createchildAttName
- the name of the attribute used. This will be set
to the appropriate value from the arraypublic static boolean isElement(org.w3c.dom.Node n)
n
- Node to test
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |