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

📄 xmldtdprocessor.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                                               "NoNotationOnEmptyElement",                                               new Object[]{elementName, attributeName},                                               XMLErrorReporter.SEVERITY_ERROR);                }            }            fTableOfIDAttributeNames = null;//should be safe to release these references            fTableOfNOTATIONAttributeNames = null;        }        // call handlers        if (fDTDHandler != null) {            fDTDHandler.endDTD(augs);        }    } // endDTD()    // sets the XMLDTDSource of this handler    public void setDTDSource(XMLDTDSource source ) {        fDTDSource = source;    } // setDTDSource(XMLDTDSource)    // returns the XMLDTDSource of this handler    public XMLDTDSource getDTDSource() {        return fDTDSource;    } // getDTDSource():  XMLDTDSource    //    // XMLDTDContentModelHandler methods    //    // sets the XMLContentModelDTDSource of this handler    public void setDTDContentModelSource(XMLDTDContentModelSource source ) {        fDTDContentModelSource = source;    } // setDTDContentModelSource(XMLDTDContentModelSource)    // returns the XMLDTDSource of this handler    public XMLDTDContentModelSource getDTDContentModelSource() {        return fDTDContentModelSource;    } // getDTDContentModelSource():  XMLDTDContentModelSource    /**     * The start of a content model. Depending on the type of the content     * model, specific methods may be called between the call to the     * startContentModel method and the call to the endContentModel method.     *      * @param elementName The name of the element.     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void startContentModel(String elementName, Augmentations augs)         throws XNIException {        if (fValidation) {            fDTDElementDeclName = elementName;            fMixedElementTypes.removeAllElements();        }        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.startContentModel(elementName, augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.startContentModel(elementName, augs);        }    } // startContentModel(String)    /**      * A content model of ANY.      *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     *     * @see #empty     * @see #startGroup     */    public void any(Augmentations augs) throws XNIException {        if(fDTDGrammar != null)             fDTDGrammar.any(augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.any(augs);        }    } // any()    /**     * A content model of EMPTY.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     *     * @see #any     * @see #startGroup     */    public void empty(Augmentations augs) throws XNIException {        if(fDTDGrammar != null)             fDTDGrammar.empty(augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.empty(augs);        }    } // empty()    /**     * A start of either a mixed or children content model. A mixed     * content model will immediately be followed by a call to the     * <code>pcdata()</code> method. A children content model will     * contain additional groups and/or elements.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     *     * @see #any     * @see #empty     */    public void startGroup(Augmentations augs) throws XNIException {        fMixed = false;        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.startGroup(augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.startGroup(augs);        }    } // startGroup()    /**     * The appearance of "#PCDATA" within a group signifying a     * mixed content model. This method will be the first called     * following the content model's <code>startGroup()</code>.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *          * @throws XNIException Thrown by handler to signal an error.     *     * @see #startGroup     */    public void pcdata(Augmentations augs) {        fMixed = true;        if(fDTDGrammar != null)             fDTDGrammar.pcdata(augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.pcdata(augs);        }    } // pcdata()    /**     * A referenced element in a mixed or children content model.     *      * @param elementName The name of the referenced element.     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void element(String elementName, Augmentations augs) throws XNIException {        // check VC: No duplicate Types, in a single mixed-content declaration        if (fMixed && fValidation) {            if (fMixedElementTypes.contains(elementName)) {                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,                                           "DuplicateTypeInMixedContent",                                           new Object[]{fDTDElementDeclName, elementName},                                           XMLErrorReporter.SEVERITY_ERROR);            }            else {                fMixedElementTypes.addElement(elementName);            }        }        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.element(elementName, augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.element(elementName, augs);        }    } // childrenElement(String)    /**     * The separator between choices or sequences of a mixed or children     * content model.     *      * @param separator The type of children separator.     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     *     * @see #SEPARATOR_CHOICE     * @see #SEPARATOR_SEQUENCE     */    public void separator(short separator, Augmentations augs)         throws XNIException {        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.separator(separator, augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.separator(separator, augs);        }    } // separator(short)    /**     * The occurrence count for a child in a children content model or     * for the mixed content model group.     *      * @param occurrence The occurrence count for the last element     *                   or group.     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     *     * @see #OCCURS_ZERO_OR_ONE     * @see #OCCURS_ZERO_OR_MORE     * @see #OCCURS_ONE_OR_MORE     */    public void occurrence(short occurrence, Augmentations augs)         throws XNIException {        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.occurrence(occurrence, augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.occurrence(occurrence, augs);        }    } // occurrence(short)    /**     * The end of a group for mixed or children content models.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void endGroup(Augmentations augs) throws XNIException {        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.endGroup(augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.endGroup(augs);        }    } // endGroup()    /**     * The end of a content model.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void endContentModel(Augmentations augs) throws XNIException {        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.endContentModel(augs);        if (fDTDContentModelHandler != null) {            fDTDContentModelHandler.endContentModel(augs);        }    } // endContentModel()    //    // Private methods    //    /**     * Normalize the attribute value of a non CDATA default attribute     * collapsing sequences of space characters (x20)     *     * @param value The value to normalize     * @return Whether the value was changed or not.     */    private boolean normalizeDefaultAttrValue(XMLString value) {        int oldLength = value.length;        boolean skipSpace = true; // skip leading spaces        int current = value.offset;        int end = value.offset + value.length;        for (int i = value.offset; i < end; i++) {            if (value.ch[i] == ' ') {                if (!skipSpace) {                    // take the first whitespace as a space and skip the others                    value.ch[current++] = ' ';                    skipSpace = true;                }                else {                    // just skip it.                }            }            else {                // simply shift non space chars if needed                if (current != i) {                    value.ch[current] = value.ch[i];                }                current++;                skipSpace = false;            }        }        if (current != end) {            if (skipSpace) {                // if we finished on a space trim it                current--;            }            // set the new value length            value.length = current - value.offset;            return true;        }        return false;    }        protected boolean isValidNmtoken(String nmtoken) {        return XMLChar.isValidNmtoken(nmtoken);    } // isValidNmtoken(String):  boolean        protected boolean isValidName(String name) {        return XMLChar.isValidName(name);    } // isValidName(String):  boolean} // class XMLDTDProcessor

⌨️ 快捷键说明

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