xpointerhandler.java

来自「JAVA 所有包」· Java 代码 · 共 1,245 行 · 第 1/4 页

JAVA
1,245
字号
                                    } else  if (chartype == CHARTYPE_CARRET) {                    ch = data.charAt(++currentOffset);                    chartype = (ch >= 0x80) ? CHARTYPE_NONASCII                            : fASCIICharMap[ch];                    if (chartype != CHARTYPE_CARRET                            && chartype != CHARTYPE_OPEN_PAREN                            && chartype != CHARTYPE_CLOSE_PAREN) {                        break;                    }                    schemeData.append((char) ch);                    ++currentOffset;                } else {                    schemeData.append((char) ch);                    ++currentOffset;//                }            }            return currentOffset;        }        //        // Protected methods        //        /**         * This method adds the specified token to the token list. By         * default, this method allows all tokens. However, subclasses         * of the XPathExprScanner can override this method in order         * to disallow certain tokens from being used in the scanned         * XPath expression. This is a convenient way of allowing only         * a subset of XPath.         */        protected void addToken(Tokens tokens, int token) throws XNIException {            tokens.addToken(token);        } // addToken(int)    } // class Scanner    // ************************************************************************    //  Overridden XMLDocumentHandler methods    // ************************************************************************    /**     * If the comment is a child of a matched element, then pass else return.     *      * @param text   The text in the comment.     * @param augs   Additional information that may include infoset augmentations     *                    * @exception XNIException     *                   Thrown by application to signal an error.     */    public void comment(XMLString text, Augmentations augs) throws XNIException {        if (!isChildFragmentResolved()) {            return;        }        super.comment(text, augs);    }    /**     * 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     *                    * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void processingInstruction(String target, XMLString data,            Augmentations augs) throws XNIException {        if (!isChildFragmentResolved()) {            return;        }        super.processingInstruction(target, data, augs);    }    /**     * The start of an element.     *      * @param element    The name of the element.     * @param attributes The element attributes.     * @param augs       Additional information that may include infoset augmentations     *                        * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void startElement(QName element, XMLAttributes attributes,            Augmentations augs) throws XNIException {        if (!resolveXPointer(element, attributes, augs,                XPointerPart.EVENT_ELEMENT_START)) {            // xml:base and xml:lang processing        	if (fFixupBase) {                processXMLBaseAttributes(attributes);        	}            if (fFixupLang) {                processXMLLangAttributes(attributes);            }            // set the context invalid if the element till an element from the result infoset is included            fNamespaceContext.setContextInvalid();             return;        }        super.startElement(element, attributes, augs);    }    /**     * An empty element.     *      * @param element    The name of the element.     * @param attributes The element attributes.     * @param augs       Additional information that may include infoset augmentations     *                        * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void emptyElement(QName element, XMLAttributes attributes,            Augmentations augs) throws XNIException {        if (!resolveXPointer(element, attributes, augs,                XPointerPart.EVENT_ELEMENT_EMPTY)) {            // xml:base and xml:lang processing        	if (fFixupBase) {                processXMLBaseAttributes(attributes);        	}                if (fFixupLang) {                processXMLLangAttributes(attributes);            }            // no need to restore restoreBaseURI() for xml:base and xml:lang processing                        // set the context invalid if the element till an element from the result infoset is included            fNamespaceContext.setContextInvalid();             return;        }        super.emptyElement(element, attributes, augs);    }    /**     * Character content.     *      * @param text   The content.     * @param augs   Additional information that may include infoset augmentations     *                    * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void characters(XMLString text, Augmentations augs)            throws XNIException {        if (!isChildFragmentResolved()) {            return;        }        super.characters(text, augs);    }    /**     * Ignorable whitespace. For this method to be called, the document     * source must have some way of determining that the text containing     * only whitespace characters should be considered ignorable. For     * example, the validator can determine if a length of whitespace     * characters in the document are ignorable based on the element     * content model.     *      * @param text   The ignorable whitespace.     * @param augs   Additional information that may include infoset augmentations     *                    * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void ignorableWhitespace(XMLString text, Augmentations augs)            throws XNIException {        if (!isChildFragmentResolved()) {            return;        }        super.ignorableWhitespace(text, augs);    }    /**     * The end of an element.     *      * @param element The name of the element.     * @param augs    Additional information that may include infoset augmentations     *                     * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void endElement(QName element, Augmentations augs)            throws XNIException {        if (!resolveXPointer(element, null, augs,                XPointerPart.EVENT_ELEMENT_END)) {            // no need to restore restoreBaseURI() for xml:base and xml:lang processing            return;        }        super.endElement(element, augs);    }    /**     * The start of a CDATA section.     *      * @param augs   Additional information that may include infoset augmentations     *                    * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void startCDATA(Augmentations augs) throws XNIException {        if (!isChildFragmentResolved()) {            return;        }        super.startCDATA(augs);    }    /**     * The end of a CDATA section.     *      * @param augs   Additional information that may include infoset augmentations     *                    * @exception XNIException     *                   Thrown by handler to signal an error.     */    public void endCDATA(Augmentations augs) throws XNIException {        if (!isChildFragmentResolved()) {            return;        }        super.endCDATA(augs);    }    // ************************************************************************    // Overridden XMLComponent methods    // ************************************************************************    /**     * <p>     * 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 XMLConfigurationException Thrown for configuration error.     *                                  In general, components should     *                                  only throw this exception if     *                                  it is <strong>really</strong>     *                                  a critical error.     */    public void setProperty(String propertyId, Object value)            throws XMLConfigurationException {        // Error reporter        if (propertyId == Constants.XERCES_PROPERTY_PREFIX                + Constants.ERROR_REPORTER_PROPERTY) {            if (value != null) {                fXPointerErrorReporter = (XMLErrorReporter) value;            } else {                fXPointerErrorReporter = null;            }        }        // Error handler        if (propertyId == Constants.XERCES_PROPERTY_PREFIX                + Constants.ERROR_HANDLER_PROPERTY) {            if (value != null) {                fErrorHandler = (XMLErrorHandler) value;            } else {                fErrorHandler = null;            }        }        // xml:lang        if (propertyId == Constants.XERCES_FEATURE_PREFIX                + Constants.XINCLUDE_FIXUP_LANGUAGE_FEATURE) {            if (value != null) {            	fFixupLang = ((Boolean)value).booleanValue();            } else {            	fFixupLang = false;            }        }                // xml:base        if (propertyId == Constants.XERCES_FEATURE_PREFIX                + Constants.XINCLUDE_FIXUP_BASE_URIS_FEATURE) {            if (value != null) {            	fFixupBase = ((Boolean)value).booleanValue();            } else {            	fFixupBase = false;            }        }                //         if (propertyId == Constants.XERCES_PROPERTY_PREFIX                + Constants.NAMESPACE_CONTEXT_PROPERTY) {            fNamespaceContext = (XIncludeNamespaceSupport) value;        }        super.setProperty(propertyId, value);    }}

⌨️ 快捷键说明

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