⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlchar.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++) {                CHARS[j] |= MASK_PUBID;            }        }    } // <clinit>()    //    // Public static methods    //    /**     * Returns true if the specified character is a supplemental character.     *     * @param c The character to check.     */    public static boolean isSupplemental(int c) {        return (c >= 0x10000 && c <= 0x10FFFF);    }    /**     * Returns true the supplemental character corresponding to the given     * surrogates.     *     * @param h The high surrogate.     * @param l The low surrogate.     */    public static int supplemental(char h, char l) {        return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000;    }    /**     * Returns the high surrogate of a supplemental character     *     * @param c The supplemental character to "split".     */    public static char highSurrogate(int c) {        return (char) (((c - 0x00010000) >> 10) + 0xD800);    }    /**     * Returns the low surrogate of a supplemental character     *     * @param c The supplemental character to "split".     */    public static char lowSurrogate(int c) {        return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00);    }    /**     * Returns whether the given character is a high surrogate     *     * @param c The character to check.     */    public static boolean isHighSurrogate(int c) {        return (0xD800 <= c && c <= 0xDBFF);    }    /**     * Returns whether the given character is a low surrogate     *     * @param c The character to check.     */    public static boolean isLowSurrogate(int c) {        return (0xDC00 <= c && c <= 0xDFFF);    }    /**     * Returns true if the specified character is valid. This method     * also checks the surrogate character range from 0x10000 to 0x10FFFF.     * <p>     * If the program chooses to apply the mask directly to the     * <code>CHARS</code> array, then they are responsible for checking     * the surrogate character range.     *     * @param c The character to check.     */    public static boolean isValid(int c) {        return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) ||               (0x10000 <= c && c <= 0x10FFFF);    } // isValid(int):boolean    /**     * Returns true if the specified character is invalid.     *     * @param c The character to check.     */    public static boolean isInvalid(int c) {        return !isValid(c);    } // isInvalid(int):boolean    /**     * Returns true if the specified character can be considered content.     *     * @param c The character to check.     */    public static boolean isContent(int c) {        return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) ||               (0x10000 <= c && c <= 0x10FFFF);    } // isContent(int):boolean    /**     * Returns true if the specified character can be considered markup.     * Markup characters include '&lt;', '&amp;', and '%'.     *     * @param c The character to check.     */    public static boolean isMarkup(int c) {        return c == '<' || c == '&' || c == '%';    } // isMarkup(int):boolean    /**     * Returns true if the specified character is a space character     * as defined by production [3] in the XML 1.0 specification.     *     * @param c The character to check.     */    public static boolean isSpace(int c) {        return c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0;    } // isSpace(int):boolean    /**     * Returns true if the specified character is a space character     * as amdended in the XML 1.1 specification.     *     * @param c The character to check.     */    public static boolean isXML11Space(int c) {        return (c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0) ||            c == 0x85 || c == 0x2028;    } // isXML11Space(int):boolean    /**     * Returns true if the specified character is a valid name start     * character as defined by production [5] in the XML 1.0     * specification.     *     * @param c The character to check.     */    public static boolean isNameStart(int c) {        return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0;    } // isNameStart(int):boolean    /**     * Returns true if the specified character is a valid name     * character as defined by production [4] in the XML 1.0     * specification.     *     * @param c The character to check.     */    public static boolean isName(int c) {        return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0;    } // isName(int):boolean    /**     * Returns true if the specified character is a valid NCName start     * character as defined by production [4] in Namespaces in XML     * recommendation.     *     * @param c The character to check.     */    public static boolean isNCNameStart(int c) {        return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0;    } // isNCNameStart(int):boolean    /**     * Returns true if the specified character is a valid NCName     * character as defined by production [5] in Namespaces in XML     * recommendation.     *     * @param c The character to check.     */    public static boolean isNCName(int c) {        return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0;    } // isNCName(int):boolean    /**     * Returns true if the specified character is a valid Pubid     * character as defined by production [13] in the XML 1.0     * specification.     *     * @param c The character to check.     */    public static boolean isPubid(int c) {        return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0;    } // isPubid(int):boolean    /*     * [5] Name ::= (Letter | '_' | ':') (NameChar)*     */    /**     * Check to see if a string is a valid Name according to [5]     * in the XML 1.0 Recommendation     *     * @param name string to check     * @return true if name is a valid Name     */    public static boolean isValidName(String name) {        if (name.length() == 0)            return false;        char ch = name.charAt(0);        if( isNameStart(ch) == false)           return false;        for (int i = 1; i < name.length(); i++ ) {           ch = name.charAt(i);           if( isName( ch ) == false ){              return false;           }        }        return true;    } // isValidName(String):boolean    /*     * from the namespace rec     * [4] NCName ::= (Letter | '_') (NCNameChar)*     */    /**     * Check to see if a string is a valid NCName according to [4]     * from the XML Namespaces 1.0 Recommendation     *     * @param ncName string to check     * @return true if name is a valid NCName     */    public static boolean isValidNCName(String ncName) {        if (ncName.length() == 0)            return false;        char ch = ncName.charAt(0);        if( isNCNameStart(ch) == false)           return false;        for (int i = 1; i < ncName.length(); i++ ) {           ch = ncName.charAt(i);           if( isNCName( ch ) == false ){              return false;           }        }        return true;    } // isValidNCName(String):boolean    /*     * [7] Nmtoken ::= (NameChar)+     */    /**     * Check to see if a string is a valid Nmtoken according to [7]     * in the XML 1.0 Recommendation     *     * @param nmtoken string to check     * @return true if nmtoken is a valid Nmtoken     */    public static boolean isValidNmtoken(String nmtoken) {        if (nmtoken.length() == 0)            return false;        for (int i = 0; i < nmtoken.length(); i++ ) {           char ch = nmtoken.charAt(i);           if(  ! isName( ch ) ){              return false;           }        }        return true;    } // isValidName(String):boolean    // encodings    /**     * Returns true if the encoding name is a valid IANA encoding.     * This method does not verify that there is a decoder available     * for this encoding, only that the characters are valid for an     * IANA encoding name.     *     * @param ianaEncoding The IANA encoding name.     */    public static boolean isValidIANAEncoding(String ianaEncoding) {        if (ianaEncoding != null) {            int length = ianaEncoding.length();            if (length > 0) {                char c = ianaEncoding.charAt(0);                if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {                    for (int i = 1; i < length; i++) {                        c = ianaEncoding.charAt(i);                        if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&                            (c < '0' || c > '9') && c != '.' && c != '_' &&                            c != '-') {                            return false;                        }                    }                    return true;                }            }        }        return false;    } // isValidIANAEncoding(String):boolean    /**     * Returns true if the encoding name is a valid Java encoding.     * This method does not verify that there is a decoder available     * for this encoding, only that the characters are valid for an     * Java encoding name.     *     * @param javaEncoding The Java encoding name.     */    public static boolean isValidJavaEncoding(String javaEncoding) {        if (javaEncoding != null) {            int length = javaEncoding.length();            if (length > 0) {                for (int i = 1; i < length; i++) {                    char c = javaEncoding.charAt(i);                    if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&                        (c < '0' || c > '9') && c != '.' && c != '_' &&                        c != '-') {                        return false;                    }                }                return true;            }        }        return false;    } // isValidIANAEncoding(String):boolean} // class XMLChar

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -