本文整理汇总了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;
}
示例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));
}
}
}
示例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;
}
示例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;
}
示例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));
}
}
}
示例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));
}
}
}
示例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));
}
}
}
示例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));
}
}
}