private Attributes filterAttributes(Attributes attributes) throws SAXException {
        int len = attributes.getLength();
        String langValue = null;
        for (int i = 0; i < len; i++) {
            String local = attributes.getLocalName(i);
            String uri = attributes.getURI(i);
            if (local == "lang" && uri == "http://www.w3.org/XML/1998/namespace") {
                langValue = attributes.getValue(i);
            } else if (local == "xml:lang" && uri == "") {
                String xmlLangValue = attributes.getValue(i);
                AttributesImpl attributesImpl = new AttributesImpl();
                for (int j = 0; j < i; j++) {
                    attributesImpl.addAttribute(attributes.getURI(j), attributes.getLocalName(j), attributes.getQName(j), attributes.getType(j), attributes.getValue(j));
                }
                for (int k = i + 1; k < len; k++) {
                    uri = attributes.getURI(k);
                    local = attributes.getLocalName(k);
                    if (local == "lang" && uri == "http://www.w3.org/XML/1998/namespace") {
                        langValue = attributes.getValue(k);
                    }
                    attributesImpl.addAttribute(uri, local, attributes.getQName(k), attributes.getType(k), attributes.getValue(k));                        
                }
                if (errorHandler != null && !equalsIgnoreAsciiCase(xmlLangValue, langValue)) {
                    errorHandler.error(new SAXParseException("When the attribute \u201Cxml:lang\u201D in no namespace is specified, the element must also have the attribute \u201Clang\u201D present with the same value.", locator));
                }
                return attributesImpl;
            }
        }
        return attributes;
    }
@param ns
@param arg1
@param arg2
@param attributes
@throws SAXException
@see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
src/nu/validator/xml/langattributes/XmlLangAttributeDroppingContentHandlerWrapper.java