Here you can find the source of getElementName(Element element)
Parameter | Description |
---|---|
element | a parameter |
public static String getElementName(Element element)
//package com.java2s; import org.w3c.dom.Element; public class Main { /**/*ww w. jav a 2 s .c o m*/ * Returns the element name of the given element. * @param element * @return String */ public static String getElementName(Element element) { // When loading from disk the local name will be setup correctly, but if the local name // is fetched directly after calling Document.createElement() then the value will be null. // See the JavaDoc for more info. To workaround this, use the complete node name. String elemName = element.getLocalName(); if (elemName == null) { elemName = element.getNodeName(); } return elemName; } }