code: private Attributes getAttributes(StartElement event)
      {
          AttributesImpl attrs = new AttributesImpl();
  
          if (!event.isStartElement()) {
              throw new InternalError("getAttributes() attempting to process: " + event);
          }
  
          // Add namspace declarations if required
          if (this.filter.getNamespacePrefixes()) {
              for (@SuppressWarnings("unchecked") Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) {
                  Namespace staxNamespace = i.next();
                  String uri = staxNamespace.getNamespaceURI();
                  if (uri == null) {
                      uri = "";
                  }
  
                  String prefix = staxNamespace.getPrefix();
                  if (prefix == null) {
                      prefix = "";
                  }
  
                  String qName = "xmlns";
                  if (prefix.length() == 0) {
                      prefix = qName;
                  } else {
                      qName = qName + ':' + prefix;
                  }
                  attrs.addAttribute("http://www.w3.org/2000/xmlns/", prefix, qName, "CDATA", uri);
              }
          }
  
          // gather non-namespace attrs
          for (@SuppressWarnings("unchecked") Iterator<Attribute> i = event.getAttributes(); i.hasNext();) {
              Attribute staxAttr = i.next();
  
              String uri = staxAttr.getName().getNamespaceURI();
              if (uri == null) {
                  uri = "";
              }
              String localName = staxAttr.getName().getLocalPart();
              String prefix = staxAttr.getName().getPrefix();
              String qName;
              if (prefix == null || prefix.length() == 0) {
                  qName = localName;
              } else {
                  qName = prefix + ':' + localName;
              }
              String type = staxAttr.getDTDType();
              String value = staxAttr.getValue();
  
              attrs.addAttribute(uri, localName, qName, type, value);
          }
  
          return attrs;
      }
docs: Get the attributes associated with the given START_ELEMENT StAXevent.
  
  @param event the StAX start element event
  @return the StAX attributes converted to an org.xml.sax.Attributes