private static void printAttributes(XMLStreamReader xmlr) {

    if (xmlr.getAttributeCount() > 0) {

      int count = xmlr.getAttributeCount();
      for (int i = 0; i < count; i++) {

        QName name = xmlr.getAttributeName(i);
        String namespace = xmlr.getAttributeNamespace(i);
        String type = xmlr.getAttributeType(i);
        String prefix = xmlr.getAttributePrefix(i);
        String value = xmlr.getAttributeValue(i);

        System.out.println(
            "\tAttribute: {" + namespace + "}:" + name.toString() + "(" + type + ")=" + value);
      }
    }
  }