当前位置: 首页>>代码示例>>Java>>正文


Java PacketParserUtils.parsePacketExtension方法代码示例

本文整理汇总了Java中org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension方法的典型用法代码示例。如果您正苦于以下问题:Java PacketParserUtils.parsePacketExtension方法的具体用法?Java PacketParserUtils.parsePacketExtension怎么用?Java PacketParserUtils.parsePacketExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smack.util.PacketParserUtils的用法示例。


在下文中一共展示了PacketParserUtils.parsePacketExtension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseIQ

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public IQ parseIQ(XmlPullParser parser) throws Exception {
	PubSub pubsub = new PubSub();
	String namespace = parser.getNamespace();
	pubsub.setPubSubNamespace(PubSubNamespace.valueOfFromXmlns(namespace));
	boolean done = false;

	while (!done) {
		int eventType = parser.next();

		if (eventType == XmlPullParser.START_TAG) {
			PacketExtension ext = PacketParserUtils.parsePacketExtension(
					parser.getName(), namespace, parser);

			if (ext != null) {
				pubsub.addExtension(ext);
			}
		} else if (eventType == XmlPullParser.END_TAG) {
			if (parser.getName().equals("pubsub")) {
				done = true;
			}
		}
	}
	return pubsub;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:25,代码来源:PubSubProvider.java

示例2: parseExtension

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
	String id = parser.getAttributeValue(null, "id");
	String elem = parser.getName();
	
	int tag = parser.next();
	
	if (tag == XmlPullParser.END_TAG)
	{
		return new Item(id);		
	}
	else
	{
		String payloadElemName = parser.getName();
		String payloadNS = parser.getNamespace();
		
        if (ProviderManager.getInstance().getExtensionProvider(payloadElemName, payloadNS) == null)
        {
    		boolean done = false;
    		StringBuilder payloadText = new StringBuilder();
    		
    		while (!done)
    		{
    			if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem))
    				done = true;
    			else if (!((tag == XmlPullParser.START_TAG) && parser.isEmptyElementTag()))
   					payloadText.append(parser.getText());
    			
    			if (!done)
    				tag = parser.next();
    		}
    		return new PayloadItem<SimplePayload>(id, new SimplePayload(payloadElemName, payloadNS, payloadText.toString()));
        }
        else
        {
        	return new PayloadItem<PacketExtension>(id, PacketParserUtils.parsePacketExtension(payloadElemName, payloadNS, parser));
        }
	}
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:40,代码来源:ItemProvider.java

示例3: parseIQ

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public IQ parseIQ(XmlPullParser parser) throws Exception
{
       PubSub pubsub = new PubSub();
       String namespace = parser.getNamespace();
       pubsub.setPubSubNamespace(PubSubNamespace.valueOfFromXmlns(namespace));
       boolean done = false;

       while (!done) 
       {
           int eventType = parser.next();
           
           if (eventType == XmlPullParser.START_TAG) 
           {
           	PacketExtension ext = PacketParserUtils.parsePacketExtension(parser.getName(), namespace, parser);
           	
           	if (ext != null)
           	{
           		pubsub.addExtension(ext);
           	}
           }
           else if (eventType == XmlPullParser.END_TAG) 
           {
               if (parser.getName().equals("pubsub")) 
               {
                   done = true;
               }
           }
       }
       return pubsub;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:31,代码来源:PubSubProvider.java

示例4: parseIQ

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public IQ parseIQ(XmlPullParser parser) throws Exception {
    Registration reg = new Registration();
    String namespace = parser.getNamespace();
    boolean done = false;

    while (!done)
    {
        int eventType = parser.next();

        if (eventType == XmlPullParser.START_TAG)
        {
            PacketExtension ext = PacketParserUtils.parsePacketExtension(parser.getName(), namespace, parser);

            if (ext != null)
            {
                reg.addExtension(ext);
            }
        }
        else if (eventType == XmlPullParser.END_TAG)
        {
            if (parser.getName().equals("query"))
            {
                done = true;
            }
        }
    }
    return reg;
}
 
开发者ID:ShadiNachat,项目名称:Chatting-App-,代码行数:29,代码来源:RegistrationFormProvider.java

示例5: parseExtension

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
	String id = parser.getAttributeValue(null, "id");
       String node = parser.getAttributeValue(null, "node");
	String elem = parser.getName();
	
	int tag = parser.next();
	
	if (tag == XmlPullParser.END_TAG)
	{
		return new Item(id, node);		
	}
	else
	{
		String payloadElemName = parser.getName();
		String payloadNS = parser.getNamespace();
		
        if (ProviderManager.getInstance().getExtensionProvider(payloadElemName, payloadNS) == null)
        {
    		boolean done = false;
    		StringBuilder payloadText = new StringBuilder();
    		
    		while (!done)
    		{
    			if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem))
    				done = true;
    			else if (!((tag == XmlPullParser.START_TAG) && parser.isEmptyElementTag()))
   					payloadText.append(parser.getText());
    			
    			if (!done)
    				tag = parser.next();
    		}
    		return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText.toString()));
        }
        else
        {
        	return new PayloadItem<PacketExtension>(id, node, PacketParserUtils.parsePacketExtension(payloadElemName, payloadNS, parser));
        }
	}
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:41,代码来源:ItemProvider.java

示例6: parseExtension

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser) throws Exception 
{
    String id = parser.getAttributeValue(null, "id");
    String node = parser.getAttributeValue(null, "node");
    String elem = parser.getName();

    int tag = parser.next();

    if (tag == XmlPullParser.END_TAG) 
    {
        return new Item(id, node);
    }
    else 
    {
        String payloadElemName = parser.getName();
        String payloadNS = parser.getNamespace();

        if (ProviderManager.getInstance().getExtensionProvider(payloadElemName, payloadNS) == null) 
        {
            boolean done = false;
            boolean isEmptyElement = false;
            StringBuilder payloadText = new StringBuilder();

            while (!done) 
            {
                if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem)) 
                {
                    done = true;
                    continue;
                }
                else if (parser.getEventType() == XmlPullParser.START_TAG) 
                {
                    payloadText.append("<").append(parser.getName());

                    if (parser.getName().equals(payloadElemName) && (payloadNS.length() > 0))
                        payloadText.append(" xmlns=\"").append(payloadNS).append("\"");
                    int n = parser.getAttributeCount();

                    for (int i = 0; i < n; i++) 
                        payloadText.append(" ").append(parser.getAttributeName(i)).append("=\"")
                                .append(parser.getAttributeValue(i)).append("\"");

                    if (parser.isEmptyElementTag()) 
                    {
                        payloadText.append("/>");
                        isEmptyElement = true;
                    }
                    else 
                    {
                        payloadText.append(">");
                    }
                }
                else if (parser.getEventType() == XmlPullParser.END_TAG) 
                {
                    if (isEmptyElement) 
                    {
                        isEmptyElement = false;
                    }
                    else 
                    {
                        payloadText.append("</").append(parser.getName()).append(">");
                    }
                }
                else if (parser.getEventType() == XmlPullParser.TEXT) 
                {
                    payloadText.append(parser.getText());
                }
                tag = parser.next();
            }
            return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText.toString()));
        }
        else 
        {
            return new PayloadItem<PacketExtension>(id, node, PacketParserUtils.parsePacketExtension(payloadElemName, payloadNS, parser));
        }
    }
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:78,代码来源:ItemProvider.java

示例7: parseExtension

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser)
		throws Exception {
	String id = parser.getAttributeValue(null, "id");
	String node = parser.getAttributeValue(null, "node");
	String elem = parser.getName();

	int tag = parser.next();

	if (tag == XmlPullParser.END_TAG) {
		return new Item(id, node);
	} else {
		while (tag != XmlPullParser.START_TAG)
			tag = parser.next();
		String payloadElemName = parser.getName();
		String payloadNS = parser.getNamespace();

		if (ProviderManager.getInstance().getExtensionProvider(
				payloadElemName, payloadNS) == null) {
			boolean done = false;
			StringBuilder payloadText = new StringBuilder();

			while (!done) {
				if (tag == XmlPullParser.END_TAG
						&& parser.getName().equals(elem))
					done = true;
				else if (!((tag == XmlPullParser.START_TAG) && parser
						.isEmptyElementTag()))
					payloadText.append(parser.getText());

				if (!done)
					tag = parser.next();
			}
			return new PayloadItem<SimplePayload>(id, node,
					new SimplePayload(payloadElemName, payloadNS,
							payloadText.toString()));
		} else {
			return new PayloadItem<PacketExtension>(id, node,
					PacketParserUtils.parsePacketExtension(payloadElemName,
							payloadNS, parser));
		}
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:43,代码来源:ItemProvider.java

示例8: parseExtension

import org.jivesoftware.smack.util.PacketParserUtils; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser) throws Exception 
{
    String id = parser.getAttributeValue(null, "id");
    String node = parser.getAttributeValue(null, "node");
    String elem = parser.getName();

    int tag = parser.next();

    if (tag == XmlPullParser.END_TAG) 
    {
        return new Item(id, node);
    }
    else 
    {
        String payloadElemName = parser.getName();
        String payloadNS = parser.getNamespace();

        if (ProviderManager.getInstance().getExtensionProvider(payloadElemName, payloadNS) == null) 
        {
            boolean done = false;
            boolean isEmptyElement = false;
            StringBuilder payloadText = new StringBuilder();

            while (!done) 
            {
                if (tag == XmlPullParser.END_TAG && parser.getName().equals(elem)) 
                {
                    done = true;
                }
                else if (parser.getEventType() == XmlPullParser.START_TAG) 
                {
                    payloadText.append("<").append(parser.getName());

                    if (parser.getName().equals(payloadElemName) && (payloadNS.length() > 0))
                        payloadText.append(" xmlns=\"").append(payloadNS).append("\"");
                    int n = parser.getAttributeCount();

                    for (int i = 0; i < n; i++) 
                        payloadText.append(" ").append(parser.getAttributeName(i)).append("=\"")
                                .append(parser.getAttributeValue(i)).append("\"");

                    if (parser.isEmptyElementTag()) 
                    {
                        payloadText.append("/>");
                        isEmptyElement = true;
                    }
                    else 
                    {
                        payloadText.append(">");
                    }
                }
                else if (parser.getEventType() == XmlPullParser.END_TAG) 
                {
                    if (isEmptyElement) 
                        isEmptyElement = false;
                    else 
                        payloadText.append("</").append(parser.getName()).append(">");
                }
                else if (parser.getEventType() == XmlPullParser.TEXT) 
                {
                    payloadText.append(parser.getText());
                }
                tag = parser.next();
            }
            return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText.toString()));
        }
        else {
            return new PayloadItem<PacketExtension>(id, node, PacketParserUtils.parsePacketExtension(
                    payloadElemName, payloadNS, parser));
        }
    }
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:73,代码来源:ItemProvider.java


注:本文中的org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。