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

📄 xmldocumentfragmentscannerimpl.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     *     * @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 {                super.setFeature(featureId, state);                // Xerces properties        if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {            String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());            if (feature.equals(Constants.NOTIFY_BUILTIN_REFS_FEATURE)) {                fNotifyBuiltInRefs = state;            }        }            } // 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 {                super.setProperty(propertyId, value);                // Xerces properties        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {            final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();            if (suffixLength == Constants.ENTITY_MANAGER_PROPERTY.length() &&                    propertyId.endsWith(Constants.ENTITY_MANAGER_PROPERTY)) {                fEntityManager = (XMLEntityManager)value;                return;            }            if (suffixLength == Constants.ENTITY_RESOLVER_PROPERTY.length() &&                    propertyId.endsWith(Constants.ENTITY_RESOLVER_PROPERTY)) {                fExternalSubsetResolver = (value instanceof ExternalSubsetResolver) ?                    (ExternalSubsetResolver) value : null;                return;            }        }                                // Xerces properties        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());            if (property.equals(Constants.ENTITY_MANAGER_PROPERTY)) {                fEntityManager = (XMLEntityManager)value;            }            return;        }            } // 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        //    // XMLDocumentSource methods    //        /**     * setDocumentHandler     *     * @param documentHandler     */    public void setDocumentHandler(XMLDocumentHandler documentHandler) {        fDocumentHandler = documentHandler;        //System.out.println(" In Set DOCUMENT HANDLER" + fDocumentHandler + " scanner =" + this);    } // setDocumentHandler(XMLDocumentHandler)            /** Returns the document handler */    public XMLDocumentHandler getDocumentHandler(){        return fDocumentHandler;    }        //    // XMLEntityHandler methods    //        /**     * This method notifies of the start of an entity. The DTD has the     * pseudo-name of "[dtd]" parameter entity names start with '%'; and     * general entities are just specified by their name.     *     * @param name     The name of the entity.     * @param identifier The resource identifier.     * @param encoding The auto-detected IANA encoding name of the entity     *                 stream. This value will be null in those situations     *                 where the entity encoding is not auto-detected (e.g.     *                 internal entities or a document entity that is     *                 parsed from a java.io.Reader).     *     * @throws XNIException Thrown by handler to signal an error.     */    public void startEntity(String name,            XMLResourceIdentifier identifier,            String encoding, Augmentations augs) throws XNIException {                // keep track of this entity before fEntityDepth is increased        if (fEntityDepth == fEntityStack.length) {            int[] entityarray = new int[fEntityStack.length * 2];            System.arraycopy(fEntityStack, 0, entityarray, 0, fEntityStack.length);            fEntityStack = entityarray;        }        fEntityStack[fEntityDepth] = fMarkupDepth;                super.startEntity(name, identifier, encoding, augs);                // WFC:  entity declared in external subset in standalone doc        if(fStandalone && fEntityStore.isEntityDeclInExternalSubset(name)) {            reportFatalError("MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",                    new Object[]{name});        }                /** we are not calling the handlers yet.. */        // call handler        if (fDocumentHandler != null && !fScanningAttribute) {            if (!name.equals("[xml]")) {                fDocumentHandler.startGeneralEntity(name, identifier, encoding, null);            }        }            } // startEntity(String,XMLResourceIdentifier,String)        /**     * This method notifies the end of an entity. The DTD has the pseudo-name     * of "[dtd]" parameter entity names start with '%'; and general entities     * are just specified by their name.     *     * @param name The name of the entity.     *     * @throws XNIException Thrown by handler to signal an error.     */    public void endEntity(String name, Augmentations augs) throws IOException, XNIException {                /**         * // flush possible pending output buffer - see scanContent         * if (fInScanContent && fStringBuffer.length != 0         * && fDocumentHandler != null) {         * fDocumentHandler.characters(fStringBuffer, null);         * fStringBuffer.length = 0; // make sure we know it's been flushed         * }         */        super.endEntity(name, augs);                // make sure markup is properly balanced        if (fMarkupDepth != fEntityStack[fEntityDepth]) {            reportFatalError("MarkupEntityMismatch", null);        }                /**/        // call handler        if (fDocumentHandler != null && !fScanningAttribute) {            if (!name.equals("[xml]")) {                fDocumentHandler.endGeneralEntity(name, null);            }        }                    } // endEntity(String)        //    // Protected methods    //        // Driver factory methods        /** Creates a content Driver. */    protected Driver createContentDriver() {        return new FragmentContentDriver();    } // createContentDriver():Driver        // scanning methods        /**     * Scans an XML or text declaration.     * <p>     * <pre>     * [23] XMLDecl ::= '&lt;?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'     * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")     * [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' |  "'" EncName "'" )     * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*     * [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'")     *                 | ('"' ('yes' | 'no') '"'))     *     * [77] TextDecl ::= '&lt;?xml' VersionInfo? EncodingDecl S? '?>'     * </pre>     *     * @param scanningTextDecl True if a text declaration is to     *                         be scanned instead of an XML     *                         declaration.     */    protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl)    throws IOException, XNIException {                // scan decl        super.scanXMLDeclOrTextDecl(scanningTextDecl, fStrings);        fMarkupDepth--;                // pseudo-attribute values        String version = fStrings[0];        String encoding = fStrings[1];        String standalone = fStrings[2];        fDeclaredEncoding = encoding;        // set standalone        fStandalone = standalone != null && standalone.equals("yes");        ///xxx see where its used.. this is not used anywhere. it may be useful for entity to store this information        //but this information is only related with Document Entity.        fEntityManager.setStandalone(fStandalone);                        // call handler        if (fDocumentHandler != null) {            if (scanningTextDecl) {                fDocumentHandler.textDecl(version, encoding, null);            } else {                fDocumentHandler.xmlDecl(version, encoding, standalone, null);            }        }               if(version != null){            fEntityScanner.setVersion(version);            fEntityScanner.setXMLVersion(version);        }        // set encoding on reader, only if encoding was not specified by the application explicitly        if (encoding != null && !fEntityScanner.getCurrentEntity().isEncodingExternallySpecified()) {             fEntityScanner.setEncoding(encoding);        }            } // scanXMLDeclOrTextDecl(boolean)        public String getPITarget(){        return fPITarget ;    }        public XMLStringBuffer getPIData(){        return fContentBuffer ;    }        //XXX: why not this function behave as per the state of the parser?    public XMLString getCharacterData(){        if(fUsebuffer){            return fContentBuffer ;        }else{            return fTempString;        }            }            /**     * Scans a processing data. This is needed to handle the situation     * where a document starts with a processing instruction whose     * target name <em>starts with</em> "xml". (e.g. xmlfoo)     *     * @param target The PI target     * @param data The XMLStringBuffer to fill in with the data     */    protected void scanPIData(String target, XMLStringBuffer data)    throws IOException, XNIException {                super.scanPIData(target, data);                //set the PI target and values        fPITarget = target ;                fMarkupDepth--;            } // scanPIData(String)        /**     * Scans a comment.     * <p>     * <pre>     * [15] Comment ::= '&lt!--' ((Char - '-') | ('-' (Char - '-')))* '-->'     * </pre>     * <p>     * <strong>Note:</strong> Called after scanning past '&lt;!--'     */    protected void scanComment() throws IOException, XNIException {        fContentBuffer.clear();        scanComment(fContentBuffer);        //getTextCharacters can also be called for reading comments        fUsebuffer = true;

⌨️ 快捷键说明

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