public class XMLUtil extends Object
XMLUtil
...Constructor and Description |
---|
XMLUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
getAttribute(Element parent,
String localName,
String namespaceURI)
Returns the value of the named attribute of the current element.
|
static Element |
getChildElement(Node parent,
String childLocalName,
String childNamespaceURI)
Returns the first child element that matches the given local name and
namespace.
|
static String |
getChildText(Element parent,
String childLocalName,
String childNamespaceURI)
Calls
getText(Element) on the first child element that matches
the given local name and namespace. |
static String |
getText(Element element)
Concatenates the values of all child nodes of type 'Text' or 'CDATA'/
|
static String |
getText(Element element,
String defaultValue)
Same as
getText(Element) except that 'defaultValue' is returned
instead of null , if the element does not contain any text. |
static boolean |
isText(Node node) |
public static boolean isText(Node node)
node
- public static String getText(Element element)
element
- null
if the length of the resulting String is 0.isText(org.w3c.dom.Node)
public static String getText(Element element, String defaultValue)
getText(Element)
except that 'defaultValue' is returned
instead of null
, if the element does not contain any text.element
- defaultValue
- defaultValue
if the element does not contain any text.public static String getChildText(Element parent, String childLocalName, String childNamespaceURI)
getText(Element)
on the first child element that matches
the given local name and namespace.parent
- childLocalName
- childNamespaceURI
- null
.getText(Element)
public static Element getChildElement(Node parent, String childLocalName, String childNamespaceURI)
null
is returned.parent
- childLocalName
- childNamespaceURI
- null
.public static String getAttribute(Element parent, String localName, String namespaceURI)
parent
- localName
- attribute local name or 'nodeName' if no namespace is
specified.namespaceURI
- or null
null
if not foundCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.