| java.lang.Object samples.addr.DOMUtils
DOMUtils | public class DOMUtils (Code) | | author: Matthew J. Duftler author: Sanjiva Weerawarana |
countKids | public static int countKids(Element elem, short nodeType)(Code) | | Count number of children of a certain type of the given element.
Parameters: elem - the element whose kids are to be counted the number of matching kids. |
findChildElementWithAttribute | public static Element findChildElementWithAttribute(Element elem, String attrName, String attrValue)(Code) | | Return the first child element of the given element which has the
given attribute with the given value.
Parameters: elem - the element whose children are to be searched Parameters: attrName - the attrib that must be present Parameters: attrValue - the desired value of the attribute the first matching child element. |
getAttribute | public static String getAttribute(Element el, String attrName)(Code) | | Returns the value of an attribute of an element. Returns null
if the attribute is not found (whereas Element.getAttribute
returns "" if an attrib is not found).
Parameters: el - Element whose attrib is looked for Parameters: attrName - name of attribute to look for the attribute value |
getAttributeNS | public static String getAttributeNS(Element el, String namespaceURI, String localPart)(Code) | | Returns the value of an attribute of an element. Returns null
if the attribute is not found (whereas Element.getAttributeNS
returns "" if an attrib is not found).
Parameters: el - Element whose attrib is looked for Parameters: namespaceURI - namespace URI of attribute to look for Parameters: localPart - local part of attribute to look for the attribute value |
getChildCharacterData | public static String getChildCharacterData(Element parentEl)(Code) | | Concat all the text and cdata node children of this elem and return
the resulting text.
Parameters: parentEl - the element whose cdata/text node values are tobe combined. the concatanated string. |
getFirstChildElement | public static Element getFirstChildElement(Element elem)(Code) | | Return the first child element of the given element. Null if no
children are found.
Parameters: elem - Element whose child is to be returned the first child element. |
getNamespaceURIFromPrefix | public static String getNamespaceURIFromPrefix(Node context, String prefix)(Code) | | Given a prefix and a node, return the namespace URI that the prefix
has been associated with. This method is useful in resolving the
namespace URI of attribute values which are being interpreted as
QNames. If prefix is null, this method will return the default
namespace.
Parameters: context - the starting node (looks up recursively from here) Parameters: prefix - the prefix to find an xmlns:prefix=uri for the namespace URI or null if not found |
getNextSiblingElement | public static Element getNextSiblingElement(Element elem)(Code) | | Return the next sibling element of the given element. Null if no
more sibling elements are found.
Parameters: elem - Element whose sibling element is to be returned the next sibling element. |
|
|