code: @Override
      public void copyStartElement(InputElementStack elemStack,
                                   AttributeCollector attrCollector)
          throws IOException, XMLStreamException
      {
          String ln = elemStack.getLocalName();
          boolean nsAware = elemStack.isNamespaceAware();
          
          /* First, since we are not to output namespace stuff as is,
           * we just need to copy the element:
           */
          if (nsAware) { // but reader is ns-aware? Need to add prefix?
              String prefix = elemStack.getPrefix();
              if (prefix != null && prefix.length() > 0) { // yup
                  ln = prefix + ":" + ln;
              }
          }
          writeStartElement(ln);
          
          /* However, if there are any namespace declarations, we probably
           * better output them just as 'normal' attributes:
           */
          if (nsAware) {
              int nsCount = elemStack.getCurrentNsCount();
              if (nsCount > 0) {
                  for (int i = 0; i < nsCount; ++i) {
                      String prefix = elemStack.getLocalNsPrefix(i);
                      if (prefix == null || prefix.length() == 0) { // default NS decl
                          prefix = XMLConstants.XML_NS_PREFIX;
                      } else {
                          prefix = "xmlns:"+prefix;
                      }
                      writeAttribute(prefix, elemStack.getLocalNsURI(i));
                  }
              }
          }
          
          /* And then let's just output attributes, if any (whether to copy
           * implicit, aka "default" attributes, is configurable)
           */
          int attrCount = mCfgCopyDefaultAttrs ?
              attrCollector.getCount() : 
              attrCollector.getSpecifiedCount();
  
          if (attrCount > 0) {
              for (int i = 0; i < attrCount; ++i) {
                  attrCollector.writeAttribute(i, mWriter, mValidator);
              }
          }
      }
docs: Element copier method implementation suitable to be used with
  non-namespace-aware writers. The only special thing here is that
  the copier can convert namespace declarations to equivalent
  attribute writes.