Code example for Node

Methods: getLocalNamegetNodeName

0
   * was not assigned a Namespace. 
   */ 
  public String getLocalNameOfNode(Node n)
  { 
 
    String name = n.getLocalName();
 
    return (null == name) ? getLocalNameOfNodeFallback(n) : name;
  } 
   
  /** 
   * Returns the local name of the given node. If the node's name begins 
   * with a namespace prefix, this is the part after the colon; otherwise 
   * it's the full node name. 
   *  
   * This method is copied from org.apache.xml.utils.DOMHelper 
   * 
   * @param n the node to be examined. 
   * 
   * @return String containing the Local Name 
   */ 
  private String getLocalNameOfNodeFallback(Node n)
  { 
 
    String qname = n.getNodeName();
    int index = qname.indexOf(':');
 
    return (index < 0) ? qname : qname.substring(index + 1);
  } 
 
Experience pair programming with AI  Get Codota for Java