code: public boolean isNamespaceNode(Node n)
    {
  
      if (Node.ATTRIBUTE_NODE == n.getNodeType())
      {
        String attrName = n.getNodeName();
  
        return (attrName.startsWith("xmlns:") || attrName.equals("xmlns"));
      }
  
      return false;
    }
docs: 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.
  
  @param n Node to be examined.
  
  @return boolean -- true iff the node is an Attr whose name is
  "xmlns" or has the "xmlns:" prefix.