public static int validateQualifiedName()

in mixins/dom-mixins/src/main/java/org/apache/axiom/dom/NSUtil.java [55:87]


    public static int validateQualifiedName(String qualifiedName) throws DOMException {
        if (qualifiedName.length() == 0) {
            throw DOMExceptionUtil.newDOMException(DOMException.INVALID_CHARACTER_ERR);
        }
        int colonPosition = -1;
        boolean checkNameStart = true;
        for (int i = 0; i < qualifiedName.length(); i++) {
            char c = qualifiedName.charAt(i);
            if (c == ':') {
                if (colonPosition == -1 && i > 0) {
                    colonPosition = i;
                    checkNameStart = true;
                } else {
                    throw DOMExceptionUtil.newDOMException(DOMException.NAMESPACE_ERR);
                }
            } else if (checkNameStart) {
                if (!isNameStartChar(c)) {
                    throw DOMExceptionUtil.newDOMException(
                            isNameChar(c)
                                    ? DOMException.NAMESPACE_ERR
                                    : DOMException.INVALID_CHARACTER_ERR);
                }
                checkNameStart = false;
            } else if (!isNameChar(c)) {
                throw DOMExceptionUtil.newDOMException(DOMException.INVALID_CHARACTER_ERR);
            }
        }
        if (checkNameStart) {
            // If we get here, then the qualified name ends with a colon
            throw DOMExceptionUtil.newDOMException(DOMException.NAMESPACE_ERR);
        }
        return colonPosition;
    }