Java Utililty Methods XML Node Local Name

List of utility methods to do XML Node Local Name

Description

The list of methods to do XML Node Local Name are organized into topic(s).

Method

ElementgetElementByTagNameNS(Node node, String namespaceURI, String localName)
get Element By Tag Name NS
NodeList nl;
if (node.getNodeType() == Node.DOCUMENT_NODE) {
    nl = ((Document) node).getElementsByTagNameNS(namespaceURI, localName);
} else if (node.getNodeType() == Node.ELEMENT_NODE) {
    nl = ((Element) node).getElementsByTagNameNS(namespaceURI, localName);
} else {
    return null;
if (nl.getLength() > 0) {
    return (Element) nl.item(0);
} else {
    return null;
StringgetLocalName(final Node n)
Retrieves the local name of the given Node
if (n == null) {
    return null;
final String name = n.getLocalName();
return name == null ? getLocalName(n.getNodeName()) : name;
StringgetLocalName(final Node node)
get Local Name
final String result = node.getLocalName();
return result != null ? result : node.getNodeName();
StringgetLocalName(Node el)
get the name of an XML element, with the namespace prefix stripped off
String locName = "";
StringTokenizer st = new StringTokenizer(el.getNodeName(), ":");
while (st.hasMoreTokens())
    locName = st.nextToken();
return locName;
StringgetLocalName(Node element)
Get the non qualified tag name
String localName = element.getLocalName();
if (localName != null) {
    return localName;
String name = element.getNodeName();
int idx = name.indexOf(":");
if (idx >= 0) {
    name = name.substring(idx + 1);
...
StringgetLocalName(Node node)
returns local name of this element if not null, otherwise returns the name of the node
String name = node.getLocalName();
return (name != null) ? name : node.getNodeName();
StringgetLocalName(Node node)
get Local Name
String name = node.getLocalName();
return name != null ? name : node.getNodeName();
StringgetLocalName(Node node)
get Local Name
if (node.getPrefix() == null)
    return node.getNodeName();
else
    return node.getLocalName();
StringgetLocalName(Node node)
get Local Name
String localName = node.getLocalName();
if (localName == null) {
    localName = node.getNodeName();
    int i = localName.indexOf(':');
    if (i != -1) {
        localName = localName.substring(i + 1);
return localName;
StringgetNodeLocalName(Node node)
get Node Local Name
String result = node.getLocalName();
if (result == null)
    result = node.getNodeName();
return result;