code: public static Map<String, String> getAttributesFromXmlReader(Reader xmlReader) {
          Map<String, String> result = new HashMap<>();
          if (xmlReader == null)
              return result;
  
          try {
              if (xmlReader.markSupported())
                  xmlReader.mark(8192); // this is the default buffer size for a BufferedReader; should be more than enough to get all available attributes...
              HierarchicalStreamReader xstreamReader = new NaaccrStreamConfiguration().getDriver().createReader(xmlReader);
              if (removeNameSpacePrefix(xstreamReader.getNodeName()).equals(NaaccrXmlUtils.NAACCR_XML_TAG_ROOT))
                  for (int i = 0; i < xstreamReader.getAttributeCount(); i++)
                      result.put(removeNameSpacePrefix(xstreamReader.getAttributeName(i)), xstreamReader.getAttribute(i));
              if (xmlReader.markSupported())
                  xmlReader.reset();
          }
          catch (IOException | RuntimeException e) {
              // ignored, result will be empty
          }
  
          return result;
      }
docs: Returns all the available attributes from the given XML reader.
  <br/><br/>
  If peeking is supported by the provided reader, this method won't consume the reader.
  <br/><br/>
  The reader is not closed after calling this method.
  @param xmlReader provided reader, cannot be null
  @return the available attributes in a map, maybe empty but never null