private Attributes extractNamespaces(Attributes attrs) throws SAXException {
  AttributesImpl attrsOnly;
  String rawName;
  int i;
  int length;
  if (attrs == null) {
    return null;
  }
  length=attrs.getLength();
  attrsOnly=new AttributesImpl(attrs);
  for (i=length - 1; i >= 0; --i) {
    rawName=attrsOnly.getQName(i);
    if (rawName.startsWith("xmlns")) {
      if (rawName.length() == 5) {
        startPrefixMapping("",attrs.getValue(i));
        attrsOnly.removeAttribute(i);
      }
 else       if (rawName.charAt(5) == ':') {
        startPrefixMapping(rawName.substring(6),attrs.getValue(i));
        attrsOnly.removeAttribute(i);
      }
    }
  }
  return attrsOnly;
}

private Attributes extractNamespaces ( Attributes attrs ) throws SAXException { AttributesImpl attrsOnly ; String rawName ; int i ; int length ; if ( attrs == null ) { return null ; } length = attrs . getLength ( ) ; attrsOnly = new AttributesImpl ( attrs ) ; for ( i = length - 1 ; i >= 0 ; -- i ) { rawName = attrsOnly . getQName ( i ) ; if ( rawName . startsWith ( "xmlns" ) ) { if ( rawName . length ( ) == 5 ) { startPrefixMapping ( "" , attrs . getValue ( i ) ) ; attrsOnly . removeAttribute ( i ) ; } else if ( rawName . charAt ( 5 ) == ':' ) { startPrefixMapping ( rawName . substring ( 6 ) , attrs . getValue ( i ) ) ; attrsOnly . removeAttribute ( i ) ; } } } return attrsOnly ; }
retrieve and remove the namespaces declarations from the list of attributes .
