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

📄 iqregisterhandler.java

📁 一款即时通讯软件
💻 JAVA
字号:
/*
 *   License
 *
 * The contents of this file are subject to the Jabber Open Source License
 * Version 1.0 (the "License").  You may not copy or use this file, in either
 * source code or executable form, except in compliance with the License.  You
 * may obtain a copy of the License at http://www.jabber.com/license/ or at
 * http://www.opensource.org/.  
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 *   Copyrights
 *
 * Portions created by or assigned to Jabber.com, Inc. are 
 * Copyright (c) 2000 Jabber.com, Inc.  All Rights Reserved.  Contact
 * information for Jabber.com, Inc. is available at http://www.jabber.com/.
 *
 * Portions Copyright (c) 1999-2000 David Waite 
 *
 *   Acknowledgements
 * 
 * Special thanks to the Jabber Open Source Contributors for their
 * suggestions and support of Jabber.
 * 
 *   Changes
 *
 * @author  $Author: chris $
 * @version $Revision: 1.1 $
 *
 * j.komzak
 * Added handling of embedded extensions (like jabber:x:data for forms).
 */

package edu.ou.kmi.buddyspace.xml;

import org.jabber.jabberbeans.sax.HandlerFactory;
import org.jabber.jabberbeans.sax.SubHandler;
import org.jabber.jabberbeans.Extension.Extension;
import org.jabber.jabberbeans.sax.Extension.HashExtensionHandler;
import org.xml.sax.SAXException;
import org.xml.sax.AttributeList;

/**
 * Handler class to build jabber:iq:register objects. All work is
 * done by the HashExtensionHandler.
 *
 * @author  David Waite <a href="mailto:dwaite@jabber.com">
 *                      <i>&lt;dwaite@jabber.com&gt;</i></a>
 * @author  $Author: chris $
 * @version $Revision: 1.1 $ 
 *
 * @author  Jiri Komzak <a href="mailto:j.komzak@open.ac.uk">
 *                      <i>&lt;j.komzak@open.ac.uk&gt;</i></a>
 * @author  $Author: chris $
 * @version $Revision: 1.1 $
 */
public class IQRegisterHandler extends HashExtensionHandler {
    
    /** StringBuffer holding data between elements */
    //protected StringBuffer elementChars;
    
    /** builder to construct the product extension object */
    //protected IQRegisterBuilder builder;

    /**
     * Creates a new <code>IQRegisterHandler</code> instance.
     */
    public IQRegisterHandler() 
    {
        super();
        builder = new IQRegisterBuilder();
    }

    
    /*
     * <code>handleStartElement</code> is overloaded by the new class to
     * provide logic to handle the element code.
     *
     * @param name a <code>String</code> value
     * @param attributes an <code>AttributeList</code> value
     * @exception SAXException if an error occurs
     */
    protected void handleStartElement(String name, AttributeList attributes) throws SAXException
    {			
            elementChars=new StringBuffer();

            //Start new handler for items that *may* be containers, but never for namespaces "ns".
            if("x".equals(name) && 
               "jabber:x:data".equals(attributes.getValue("xmlns")))
                
                setChildSubHandler(new XDataHandler(), name, attributes);
            //setChildSubHandler(new LayerTagHandler(), name, attributes);
            
            // if this is has a handler, we switch off to it.
            /*HandlerFactory hf = getHandlerFactory();
            SubHandler newHandler = hf.getHandlerInstance(name, attributes);
            if (newHandler != null) {
                setChildSubHandler(newHandler, name, attributes);
                return;
            }*/
    }

    
    /*
     * <code>receiveChildData</code> is called when a child handler exits,
     * returning control to this code. The now-defunct handler along with the
     * data object are both returned.
     *
     * @param subHandler a <code>SubHandler</code> value
     * @param o an <code>Object</code> value
     */
    protected void receiveChildData(SubHandler subHandler, Object o)
    {
            //Add the returned object to the child vector
            ((IQRegisterBuilder)builder).addExtension((Extension)o);
    }
	
}

⌨️ 快捷键说明

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