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

📄 xmldtdprocessor.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        }        try {            fDTDValidation =                !(componentManager                    .getFeature(                        Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE));        } catch (XMLConfigurationException e) {            // must be in a schema-less configuration!            fDTDValidation = true;        }        // Xerces features        try {            fWarnDuplicateAttdef = componentManager.getFeature(WARN_ON_DUPLICATE_ATTDEF);        } catch (XMLConfigurationException e) {            fWarnDuplicateAttdef = false;        }        // get needed components        fErrorReporter =            (XMLErrorReporter) componentManager.getProperty(                Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY);        fSymbolTable =            (SymbolTable) componentManager.getProperty(                Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY);        try {            fGrammarPool = (XMLGrammarPool) componentManager.getProperty(GRAMMAR_POOL);        } catch (XMLConfigurationException e) {            fGrammarPool = null;        }        try {            fValidator = (XMLDTDValidator) componentManager.getProperty(DTD_VALIDATOR);        } catch (XMLConfigurationException e) {            fValidator = null;        } catch (ClassCastException e) {            fValidator = null;        }        // we get our grammarBucket from the validator...        if (fValidator != null) {            fGrammarBucket = fValidator.getGrammarBucket();        } else {            fGrammarBucket = null;        }        reset();    } // reset(XMLComponentManager)    protected void reset() {        // clear grammars        fDTDGrammar = null;        // initialize state        fInDTDIgnore = false;        fNDataDeclNotations.clear();        // datatype validators        if (fValidation) {            if (fNotationEnumVals == null) {                fNotationEnumVals = new Hashtable();            }            fNotationEnumVals.clear();            fTableOfIDAttributeNames = new Hashtable();            fTableOfNOTATIONAttributeNames = new Hashtable();        }    }    /**     * Returns a list of feature identifiers that are recognized by     * this component. This method may return null if no features     * are recognized by this component.     */    public String[] getRecognizedFeatures() {        return (String[])(RECOGNIZED_FEATURES.clone());    } // getRecognizedFeatures():String[]    /**     * Sets the state of a feature. This method is called by the component     * manager any time after reset when a feature changes state.      * <p>     * <strong>Note:</strong> Components should silently ignore features     * that do not affect the operation of the component.     *      * @param featureId The feature identifier.     * @param state     The state of the feature.     *     * @throws SAXNotRecognizedException The component should not throw     *                                   this exception.     * @throws SAXNotSupportedException The component should not throw     *                                  this exception.     */    public void setFeature(String featureId, boolean state)            throws XMLConfigurationException {    } // setFeature(String,boolean)    /**     * Returns a list of property identifiers that are recognized by     * this component. This method may return null if no properties     * are recognized by this component.     */    public String[] getRecognizedProperties() {        return (String[])(RECOGNIZED_PROPERTIES.clone());    } // getRecognizedProperties():String[]    /**     * Sets the value of a property. This method is called by the component     * manager any time after reset when a property changes value.      * <p>     * <strong>Note:</strong> Components should silently ignore properties     * that do not affect the operation of the component.     *      * @param propertyId The property identifier.     * @param value      The value of the property.     *     * @throws SAXNotRecognizedException The component should not throw     *                                   this exception.     * @throws SAXNotSupportedException The component should not throw     *                                  this exception.     */    public void setProperty(String propertyId, Object value)            throws XMLConfigurationException {    } // setProperty(String,Object)    /**      * Returns the default state for a feature, or null if this     * component does not want to report a default value for this     * feature.     *     * @param featureId The feature identifier.     *     * @since Xerces 2.2.0     */    public Boolean getFeatureDefault(String featureId) {        for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {            if (RECOGNIZED_FEATURES[i].equals(featureId)) {                return FEATURE_DEFAULTS[i];            }        }        return null;    } // getFeatureDefault(String):Boolean    /**      * Returns the default state for a property, or null if this     * component does not want to report a default value for this     * property.      *     * @param propertyId The property identifier.     *     * @since Xerces 2.2.0     */    public Object getPropertyDefault(String propertyId) {        for (int i = 0; i < RECOGNIZED_PROPERTIES.length; i++) {            if (RECOGNIZED_PROPERTIES[i].equals(propertyId)) {                return PROPERTY_DEFAULTS[i];            }        }        return null;    } // getPropertyDefault(String):Object    //    // XMLDTDSource methods    //    /**     * Sets the DTD handler.     *      * @param dtdHandler The DTD handler.     */    public void setDTDHandler(XMLDTDHandler dtdHandler) {        fDTDHandler = dtdHandler;    } // setDTDHandler(XMLDTDHandler)    /**     * Returns the DTD handler.     *      * @return The DTD handler.     */    public XMLDTDHandler getDTDHandler() {        return fDTDHandler;    } // getDTDHandler():  XMLDTDHandler    //    // XMLDTDContentModelSource methods    //    /**     * Sets the DTD content model handler.     *      * @param dtdContentModelHandler The DTD content model handler.     */    public void setDTDContentModelHandler(XMLDTDContentModelHandler dtdContentModelHandler) {        fDTDContentModelHandler = dtdContentModelHandler;    } // setDTDContentModelHandler(XMLDTDContentModelHandler)    /**     * Gets the DTD content model handler.     *      * @return dtdContentModelHandler The DTD content model handler.     */    public XMLDTDContentModelHandler getDTDContentModelHandler() {        return fDTDContentModelHandler;    } // getDTDContentModelHandler():  XMLDTDContentModelHandler    //    // XMLDTDContentModelHandler and XMLDTDHandler methods    //    /**     * The start of the DTD external subset.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void startExternalSubset(XMLResourceIdentifier identifier,                                     Augmentations augs) throws XNIException {        if(fDTDGrammar != null)             fDTDGrammar.startExternalSubset(identifier, augs);        if(fDTDHandler != null){            fDTDHandler.startExternalSubset(identifier, augs);        }    }    /**     * The end of the DTD external subset.     *     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void endExternalSubset(Augmentations augs) throws XNIException {        if(fDTDGrammar != null)             fDTDGrammar.endExternalSubset(augs);        if(fDTDHandler != null){            fDTDHandler.endExternalSubset(augs);        }    }    /**      * Check standalone entity reference.      * Made static to make common between the validator and loader.     *      * @param name     *@param grammar    grammar to which entity belongs     * @param tempEntityDecl    empty entity declaration to put results in     * @param errorReporter     error reporter to send errors to     *     * @throws XNIException Thrown by application to signal an error.     */    protected static void checkStandaloneEntityRef(String name, DTDGrammar grammar,                    XMLEntityDecl tempEntityDecl, XMLErrorReporter errorReporter) throws XNIException {        // check VC: Standalone Document Declartion, entities references appear in the document.        int entIndex = grammar.getEntityDeclIndex(name);        if (entIndex > -1) {            grammar.getEntityDecl(entIndex, tempEntityDecl);            if (tempEntityDecl.inExternal) {                errorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,                                            "MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",                                            new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR);            }        }    }    /**     * A comment.     *      * @param text The text in the comment.     * @param augs   Additional information that may include infoset augmentations     *     * @throws XNIException Thrown by application to signal an error.     */    public void comment(XMLString text, Augmentations augs) throws XNIException {        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.comment(text, augs);        if (fDTDHandler != null) {            fDTDHandler.comment(text, augs);        }    } // comment(XMLString)    /**     * A processing instruction. Processing instructions consist of a     * target name and, optionally, text data. The data is only meaningful     * to the application.     * <p>     * Typically, a processing instruction's data will contain a series     * of pseudo-attributes. These pseudo-attributes follow the form of     * element attributes but are <strong>not</strong> parsed or presented     * to the application as anything other than text. The application is     * responsible for parsing the data.     *      * @param target The target.     * @param data   The data or null if none specified.          * @param augs   Additional information that may include infoset augmentations     *     * @throws XNIException Thrown by handler to signal an error.     */    public void processingInstruction(String target, XMLString data, Augmentations augs)    throws XNIException {        // call handlers        if(fDTDGrammar != null)             fDTDGrammar.processingInstruction(target, data, augs);        if (fDTDHandler != null) {            fDTDHandler.processingInstruction(target, data, augs);        }    } // processingInstruction(String,XMLString)    //    // XMLDTDHandler methods    //    /**     * The start of the DTD.     *     * @param locator  The document locator, or null if the document     *                 location cannot be reported during the parsing of      *                 the document DTD. However, it is <em>strongly</em>     *                 recommended that a locator be supplied that can      *                 at least report the base system identifier of the     *                 DTD.     * @param augs Additional information that may include infoset     *                      augmentations.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {        // initialize state        fNDataDeclNotations.clear();        fDTDElementDecls.removeAllElements();

⌨️ 快捷键说明

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