@Override
    public void startElement(String uri, String localName, String qName,
            Attributes atts) throws SAXException {
        if (depth == 0) {
            if (isInNamespacesToRemove(uri)) {
                if (rootSeen) {
                    depth = 1;
                    if (!alreadyWarnedAboutFiltering) {
                        warning(new SAXParseException(
                                "Content is being hidden from the validator based on namespace filtering.",
                                locator));
                        alreadyWarnedAboutFiltering = true;
                    }
                } else {
                    warning(new SAXParseException(
                            "Cannot filter out the root element.", locator));
                    contentHandler.startElement(uri, localName, qName,
                            filterAttributes(atts));
                }
            } else {
                contentHandler.startElement(uri, localName, qName,
                        filterAttributes(atts));
            }
        } else {
            if (!alreadyWarnedAboutForeign && !isInNamespacesToRemove(uri)) {
                warning(new SAXParseException(
                        "Filtering out selected namespaces causes descendants in other namespaces to be dropped as well.",
                        locator));
                alreadyWarnedAboutForeign = true;
            }
            depth++;
        }
        rootSeen = true;
    }
@see org.xml.sax.helpers.XMLFilterImpl#startElement(java.lang.String,
     java.lang.String, java.lang.String, org.xml.sax.Attributes)
src/nu/validator/xml/NamespaceDroppingXMLReaderWrapper.java