code: public static QName getQName(Node n) {
          String s = n.getLocalName();
          String p = n.getPrefix();
          return s != null
              ? new QName(n.getNamespaceURI(), s,
                          p != null ? p: XMLConstants.DEFAULT_NS_PREFIX)
              : new QName(n.getNodeName());
      }
docs: Extracts a Node's name, namespace URI (if any) and prefix as a
  QName.