private void declarePrefix(String prefix, String uri) throws SAXException {
        // NOTE: uri may be the empty string

        int index = uri.indexOf(':');

        // many versions of nwalsh docbook stylesheets
        // have bogus URLs; so this can't be an error...
        if (index < 1 && uri.length() != 0) {
            warn("relative URI for namespace: " + uri);
        }

        // char [0] must be ascii alpha [RFC 2396]
        if (uri.length() != 0 && !isAlpha(uri.charAt(0))) {
            fatal("First character of the URI must be ascii alpha");
        }

        // chars [1..index] must be ascii alphanumeric or in "+-." [RFC 2396]
        for (int i = 1; i < index; i++) {
            if (!isAlphanumericOrPlusMinusPoint(uri.charAt(i))) {
                fatal("Character " + i
                        + " of the URI must be ascii alpha or in \"+-.\"");
            }
        }

        // Namespace Constraints
        // name for xml prefix must be http://www.w3.org/XML/1998/namespace
        boolean prefixEquality = prefix.equals("xml");
        boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace");
        if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) {
            fatal("xml is by definition bound to the namespace name "
                    + "http://www.w3.org/XML/1998/namespace");
        }

        // xmlns prefix declaration is illegal but xml prefix declaration is
        // llegal...
        if (prefixEquality && uriEquality) {
            return;
        }

        // name for xmlns prefix must be http://www.w3.org/2000/xmlns/
        prefixEquality = prefix.equals("xmlns");
        uriEquality = uri.equals("http://www.w3.org/2000/xmlns/");
        if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) {
            fatal("http://www.w3.org/2000/xmlns/ is by definition bound"
                    + " to prefix xmlns");
        }

        // even if the uri is http://www.w3.org/2000/xmlns/
        // it is illegal to declare it
        if (prefixEquality && uriEquality) {
            fatal("declaring the xmlns prefix is illegal");
        }

        uri = uri.intern();
        prefixStack.declarePrefix(prefix, uri);
        contentHandler.startPrefixMapping(prefix, uri);
    }
<b>SAX2</b>: Assigns the specified property. Like SAX1 handlers, these
may be changed at any time.
src/nu/validator/gnu/xml/aelfred2/SAXDriver.java