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

📄 eventfilter.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	// We delegate through the "xxNext" handlers, and	// report the "xxHandler" ones on our input side.	// Normally a subclass would both override handler	// methods and register itself as the "xxHandler".	docHandler = docNext = consumer.getContentHandler ();	dtdHandler = dtdNext = consumer.getDTDHandler ();	try {	    declHandler = declNext = (DeclHandler)		    consumer.getProperty (DECL_HANDLER);	} catch (SAXException e) { /* leave value null */ }	try {	    lexHandler = lexNext = (LexicalHandler)		    consumer.getProperty (LEXICAL_HANDLER);	} catch (SAXException e) { /* leave value null */ }    }    /**     * Treats the XMLFilterImpl as a limited functionality event consumer,     * by arranging to deliver events to it; this lets such classes be     * "wrapped" as pipeline stages.     *     * <p> <em>Upstream Event Setup:</em>     * If no handlers have been assigned to this EventFilter, then the     * handlers from specified XMLFilterImpl are returned from this     * {@link EventConsumer}: the XMLFilterImpl is just "wrapped".     * Otherwise the specified handlers will be returned.     *     * <p> <em>Downstream Event Setup:</em>     * Subclasses may chain event delivery to the specified XMLFilterImpl     * by invoking the appropiate superclass methods,     * as if their constructor passed a "next" EventConsumer to the     * constructor for this class.     * If this EventFilter has an ErrorHandler, it is assigned as     * the error handler for the XMLFilterImpl, just as would be     * done for a next stage implementing {@link EventConsumer}.     *     * @param next the next downstream component of the pipeline.     * @exception IllegalStateException if the "next" consumer has     *	already been set through the constructor.     */    public void chainTo (XMLFilterImpl next)    {	if (this.next != null)	    throw new IllegalStateException ();	docNext = next.getContentHandler ();	if (docHandler == null)	    docHandler = docNext;	dtdNext = next.getDTDHandler ();	if (dtdHandler == null)	    dtdHandler = dtdNext;	try {	    declNext = (DeclHandler) next.getProperty (DECL_HANDLER);	    if (declHandler == null)		declHandler = declNext;	} catch (SAXException e) { /* leave value null */ }	try {	    lexNext = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);	    if (lexHandler == null)		lexHandler = lexNext;	} catch (SAXException e) { /* leave value null */ }	if (errHandler != null)	    next.setErrorHandler (errHandler);    }    /**     * Records the error handler that should be used by this stage, and     * passes it "downstream" to any subsequent stage.     */    final public void setErrorHandler (ErrorHandler handler)    {	errHandler = handler;	if (next != null)	    next.setErrorHandler (handler);    }    /**     * Returns the error handler assigned this filter stage, or null     * if no such assigment has been made.     */    final public ErrorHandler getErrorHandler ()    {	return errHandler;    }    /**     * Returns the next event consumer in sequence; or null if there     * is no such handler.     */    final public EventConsumer getNext ()	{ return next; }    /**     * Assigns the content handler to use; a null handler indicates     * that these events will not be forwarded.     * This overrides the previous settting for this handler, which was     * probably pointed to the next consumer by the base class constructor.     */    final public void setContentHandler (ContentHandler h)    {	docHandler = h;    }    /** Returns the content handler being used. */    final public ContentHandler getContentHandler ()    {	return docHandler;    }    /**     * Assigns the DTD handler to use; a null handler indicates     * that these events will not be forwarded.     * This overrides the previous settting for this handler, which was     * probably pointed to the next consumer by the base class constructor.     */    final public void setDTDHandler (DTDHandler h)	{ dtdHandler = h; }    /** Returns the dtd handler being used. */    final public DTDHandler getDTDHandler ()    {	return dtdHandler;    }    /**     * Stores the property, normally a handler; a null handler indicates     * that these events will not be forwarded.     * This overrides the previous handler settting, which was probably     * pointed to the next consumer by the base class constructor.     */    final public void setProperty (String id, Object o)    throws SAXNotRecognizedException, SAXNotSupportedException    {	try {	    Object	value = getProperty (id);	    if (value == o)		return;	    if (DECL_HANDLER.equals (id)) {		declHandler = (DeclHandler) o;		return;	    }	    if (LEXICAL_HANDLER.equals (id)) {		lexHandler = (LexicalHandler) o;		return;	    }	    throw new SAXNotSupportedException (id);	} catch (ClassCastException e) {	    throw new SAXNotSupportedException (id);	}    }    /** Retrieves a property of unknown intent (usually a handler) */    final public Object getProperty (String id)    throws SAXNotRecognizedException    {	if (DECL_HANDLER.equals (id)) 	    return declHandler;	if (LEXICAL_HANDLER.equals (id))	    return lexHandler;	throw new SAXNotRecognizedException (id);    }    /**     * Returns any locator provided to the next consumer, if this class     * (or a subclass) is handling {@link ContentHandler } events.     */    public Locator getDocumentLocator ()	{ return locator; }    // CONTENT HANDLER DELEGATIONS    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void setDocumentLocator (Locator locator)    {	this.locator = locator;	if (docNext != null)	    docNext.setDocumentLocator (locator);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void startDocument () throws SAXException    {	if (docNext != null)	    docNext.startDocument ();    }    public void xmlDecl(String version, String encoding, boolean standalone,                        String inputEncoding)      throws SAXException    {      if (docNext != null && docNext instanceof ContentHandler2)        {          ((ContentHandler2) docNext).xmlDecl(version, encoding, standalone,                                              inputEncoding);        }    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void skippedEntity (String name) throws SAXException    {	if (docNext != null)	    docNext.skippedEntity (name);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void processingInstruction (String target, String data)    throws SAXException    {	if (docNext != null)	    docNext.processingInstruction (target, data);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void characters (char ch [], int start, int length)    throws SAXException    {	if (docNext != null)	    docNext.characters (ch, start, length);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void ignorableWhitespace (char ch [], int start, int length)    throws SAXException    {	if (docNext != null)	    docNext.ignorableWhitespace (ch, start, length);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void startPrefixMapping (String prefix, String uri)    throws SAXException    {	if (docNext != null)	    docNext.startPrefixMapping (prefix, uri);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void startElement (	String uri, String localName,	String qName, Attributes atts    ) throws SAXException    {	if (docNext != null)	    docNext.startElement (uri, localName, qName, atts);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void endElement (String uri, String localName, String qName)    throws SAXException    {	if (docNext != null)	    docNext.endElement (uri, localName, qName);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void endPrefixMapping (String prefix) throws SAXException    {	if (docNext != null)	    docNext.endPrefixMapping (prefix);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void endDocument () throws SAXException    {	if (docNext != null)	    docNext.endDocument ();	locator = null;    }    // DTD HANDLER DELEGATIONS        /** <b>SAX1:</b> passes this callback to the next consumer, if any */    public void unparsedEntityDecl (	String name,	String publicId,	String systemId,	String notationName    ) throws SAXException    {	if (dtdNext != null)	    dtdNext.unparsedEntityDecl (name, publicId, systemId, notationName);    }        /** <b>SAX1:</b> passes this callback to the next consumer, if any */    public void notationDecl (String name, String publicId, String systemId)    throws SAXException    {	if (dtdNext != null)	    dtdNext.notationDecl (name, publicId, systemId);    }        // LEXICAL HANDLER DELEGATIONS    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void startDTD (String name, String publicId, String systemId)    throws SAXException    {	if (lexNext != null)	    lexNext.startDTD (name, publicId, systemId);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void endDTD ()    throws SAXException    {	if (lexNext != null)	    lexNext.endDTD ();    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void comment (char ch [], int start, int length)    throws SAXException    {	if (lexNext != null)	    lexNext.comment (ch, start, length);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void startCDATA ()    throws SAXException    {	if (lexNext != null)	    lexNext.startCDATA ();    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void endCDATA ()    throws SAXException    {	if (lexNext != null)	    lexNext.endCDATA ();    }    /**     * <b>SAX2:</b> passes this callback to the next consumer, if any.     */    public void startEntity (String name)    throws SAXException    {	if (lexNext != null)	    lexNext.startEntity (name);    }    /**     * <b>SAX2:</b> passes this callback to the next consumer, if any.     */    public void endEntity (String name)    throws SAXException    {	if (lexNext != null)	    lexNext.endEntity (name);    }        // DECLARATION HANDLER DELEGATIONS    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void elementDecl (String name, String model)    throws SAXException    {	if (declNext != null)	    declNext.elementDecl (name, model);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void attributeDecl (String eName, String aName,	    String type, String mode, String value)    throws SAXException    {	if (declNext != null)	    declNext.attributeDecl (eName, aName, type, mode, value);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void externalEntityDecl (String name,    	String publicId, String systemId)    throws SAXException    {	if (declNext != null)	    declNext.externalEntityDecl (name, publicId, systemId);    }    /** <b>SAX2:</b> passes this callback to the next consumer, if any */    public void internalEntityDecl (String name, String value)    throws SAXException    {	if (declNext != null)	    declNext.internalEntityDecl (name, value);    }}

⌨️ 快捷键说明

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