public boolean isNamespaceNode(Node n){
  if (Node.ATTRIBUTE_NODE == n.getNodeType()) {
    String attrName=n.getNodeName();
    return (attrName.startsWith("xmlns:") || attrName.equals("xmlns"));
  }
  return false;
}

public boolean isNamespaceNode ( Node n ) { if ( Node . ATTRIBUTE_NODE == n . getNodeType ( ) ) { String attrName = n . getNodeName ( ) ; return ( attrName . startsWith ( "xmlns:" ) || attrName . equals ( "xmlns" ) ) ; } return false ; }
test whether the given node is a namespace decl node . in dom level 2 this can be done in a namespace - aware manner , but in level 1 doms it has to be done by testing the node name .
