當前位置: 首頁>>代碼示例>>Java>>正文


Java Stanza.getChildrenNS方法代碼示例

本文整理匯總了Java中tigase.jaxmpp.core.client.xmpp.stanzas.Stanza.getChildrenNS方法的典型用法代碼示例。如果您正苦於以下問題:Java Stanza.getChildrenNS方法的具體用法?Java Stanza.getChildrenNS怎麽用?Java Stanza.getChildrenNS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tigase.jaxmpp.core.client.xmpp.stanzas.Stanza的用法示例。


在下文中一共展示了Stanza.getChildrenNS方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza responseStanza) throws JaxmppException {
	Element pubsub = responseStanza.getChildrenNS("pubsub", PUBSUB_XMLNS);
	if (pubsub == null)
		pubsub = responseStanza.getChildrenNS("pubsub", PUBSUB_OWNER_XMLNS);
	Element affiliations = getFirstChild(pubsub, "affiliations");
	String node = affiliations.getAttribute("node");

	ArrayList<AffiliationElement> affiliationWrappers = new ArrayList<AffiliationElement>();
	List<Element> afch = affiliations.getChildren();
	if (afch != null)
		for (Element element : afch) {
			affiliationWrappers.add(new AffiliationElement(element));
		}

	onRetrieve((IQ) responseStanza, node, affiliationWrappers);
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:18,代碼來源:PubSubModule.java

示例2: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza responseStanza) throws XMLException {
	this.responseStanza = responseStanza;
	Element query = responseStanza.getChildrenNS("query", INFO_XMLNS);
	List<Element> identities = query.getChildren("identity");
	ArrayList<Identity> idres = new ArrayList<Identity>();
	for (Element id : identities) {
		Identity t = new Identity();
		t.setName(id.getAttribute("name"));
		t.setType(id.getAttribute("type"));
		t.setCategory(id.getAttribute("category"));
		idres.add(t);
	}

	List<Element> features = query.getChildren("feature");
	ArrayList<String> feres = new ArrayList<String>();
	for (Element element : features) {
		String v = element.getAttribute("var");
		if (v != null)
			feres.add(v);
	}

	String n = query.getAttribute("node");
	onInfoReceived(n == null ? requestedNode : n, idres, feres);
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:26,代碼來源:DiscoveryModule.java

示例3: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess( Stanza responseStanza ) throws XMLException {
	final Element query = responseStanza.getChildrenNS( "query", ITEMS_XMLNS );
	List<Element> ritems = query.getChildren( "item" );
	ArrayList<Item> items = new ArrayList<Item>();
	for ( Element i : ritems ) {
		Item to = new Item();
		if ( i.getAttribute( "jid" ) != null ){
			to.setJid( JID.jidInstance( i.getAttribute( "jid" ) ) );
		}
		to.setName( i.getAttribute( "name" ) );
		to.setNode( i.getAttribute( "node" ) );
		if ( i.getAttribute( "type" ) != null ){
			to.setType( MSG_TYPE.valueOf( i.getAttribute( "type" ) ) );
		}
		items.add( to );
	}
	onOfflineMessageListReceived( items );
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:20,代碼來源:FlexibleOfflineMessageRetrieval.java

示例4: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void onSuccess(final Stanza responseStanza) throws JaxmppException {
	this.response = (IQ) responseStanza;
	this.command = responseStanza.getChildrenNS("command", "http://jabber.org/protocol/commands");

	if (this.command != null) {
		String sessionid = this.command.getAttribute("sessionid");
		String node = this.command.getAttribute("node");
		State status = this.command.getAttribute("status") == null ? null
				: State.valueOf(this.command.getAttribute("status"));

		JabberDataElement data = new JabberDataElement(this.command.getChildrenNS("x", "jabber:x:data"));

		onResponseReceived(sessionid, node, status, data);
	}

}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:21,代碼來源:AdHocCommansModule.java

示例5: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(final Stanza stanza) throws XMLException {
	ResultSet<Chat> rs = new ResultSet<Chat>();

	Element rsm = stanza.getChildrenNS("set", "http://jabber.org/protocol/rsm");
	if (rsm != null) {
		rs.process(rsm);
	}

	for (Element it : stanza.getChildrenNS("list", ARCHIVE_XMLNS).getChildren()) {
		if ("chat".equals(it.getName())) {
			Chat chat = new Chat();
			chat.process(it, format);
			rs.getItems().add(chat);
		}
	}
	onCollectionReceived(rs);
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:19,代碼來源:MessageArchivingModule.java

示例6: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza responseStanza) throws JaxmppException {
	final Element event = responseStanza.getChildrenNS("pubsub", PUBSUB_XMLNS);
	List<Element> tmp = event == null ? null : event.getChildren("items");
	final Element items = tmp == null || tmp.isEmpty() ? null : tmp.get(0);
	final String nodeName = items == null ? null : items.getAttribute("node");

	ArrayList<Item> result = new ArrayList<Item>();

	List<Element> itemElements = items == null ? null : items.getChildren("item");
	if (itemElements != null)
		for (Element item : itemElements) {
			final String itemId = item.getAttribute("id");
			final Element payload = item.getFirstChild();

			Item it = new Item(itemId, payload);
			result.add(it);
		}

	onRetrieve((IQ) responseStanza, nodeName, result);
}
 
開發者ID:liule,項目名稱:tigase-jaxmpp2,代碼行數:22,代碼來源:PubSubModule.java

示例7: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza responseStanza) throws XMLException {
	Element query = responseStanza.getChildrenNS("query", "http://jabber.org/protocol/disco#info");
	List<Element> identities = query.getChildren("identity");
	ArrayList<Identity> idres = new ArrayList<DiscoInfoModule.Identity>();
	for (Element id : identities) {
		Identity t = new Identity();
		t.setName(id.getAttribute("name"));
		t.setType(id.getAttribute("type"));
		t.setCategory(id.getAttribute("category"));
		idres.add(t);
	}

	List<Element> features = query.getChildren("feature");
	ArrayList<String> feres = new ArrayList<String>();
	for (Element element : features) {
		String v = element.getAttribute("var");
		if (v != null)
			feres.add(v);
	}

	String n = query.getAttribute("node");
	onInfoReceived(n == null ? requestedNode : n, idres, feres);
}
 
開發者ID:liule,項目名稱:tigase-jaxmpp2,代碼行數:25,代碼來源:DiscoInfoModule.java

示例8: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(final Stanza responseStanza) throws XMLException {
	Element query = responseStanza.getChildrenNS("query", "jabber:iq:version");
	if (query != null) {
		String eName = getFirst(query.getChildren("name"));
		String eVersion = getFirst(query.getChildren("version"));
		String eOs = getFirst(query.getChildren("os"));
		onVersionReceived(eName, eVersion, eOs);
	}
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:11,代碼來源:SoftwareVersionModule.java

示例9: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza responseStanza) throws JaxmppException {
	final Element query = responseStanza.getChildrenNS("query", OWNER_XMLNS);
	Element x = query.getChildrenNS("x", "jabber:x:data");

	JabberDataElement r = new JabberDataElement(x);

	onConfigurationReceived(r);
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:10,代碼來源:MucModule.java

示例10: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(final Stanza responseStanza) throws XMLException {
	Element query = responseStanza.getChildrenNS("vCard", "vcard-temp");
	if (query != null) {
		VCard v = new VCard();
		v.loadData(query);
		onVCardReceived(v);
	}
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:10,代碼來源:VCardModule.java

示例11: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza stanza) throws JaxmppException {
	boolean ok = false;
	String sid = null;

	Element si = stanza.getChildrenNS("si", "http://jabber.org/protocol/si");
	if (si != null) {
		sid = si.getAttribute("id");
		Element feature = si.getChildrenNS("feature", "http://jabber.org/protocol/feature-neg");
		if (feature != null) {
			Element x = feature.getChildrenNS("x", "jabber:x:data");
			if (x != null) {
				Element field = x.getFirstChild();
				if (field != null) {
					Element value = field.getFirstChild();
					if (value != null) {
						ok = Socks5BytestreamsModule.XMLNS_BS.equals(value.getValue());
					}
				}
			}
		}
	}

	if (sid == null) {
		sid = this.sid;
	}

	if (ok) {
		onAccept(sid);
	} else {
		onError();
	}
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:34,代碼來源:StreamInitiationOfferAsyncCallback.java

示例12: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(Stanza responseStanza) throws XMLException {
	final Element query = responseStanza.getChildrenNS("query", "http://jabber.org/protocol/disco#items");
	List<Element> ritems = query.getChildren("item");
	ArrayList<Item> items = new ArrayList<DiscoItemsModule.Item>();
	for (Element i : ritems) {
		Item to = new Item();
		if (i.getAttribute("jid") != null)
			to.setJid(JID.jidInstance(i.getAttribute("jid")));
		to.setName(i.getAttribute("name"));
		to.setNode(i.getAttribute("node"));
		items.add(to);
	}
	onInfoReceived(query.getAttribute("node"), items);
}
 
開發者ID:liule,項目名稱:tigase-jaxmpp2,代碼行數:16,代碼來源:DiscoItemsModule.java

示例13: onSuccess

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
@Override
public void onSuccess(final Stanza stanza) throws XMLException {
	Element query = stanza.getChildrenNS("query", "jabber:iq:private");
	Element storage = query.getChildrenNS("storage", BOOKMARKS_XMLNS);
	onBookmarksReceived(storage.getChildren());
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:7,代碼來源:BookmarksModule.java

示例14: extract

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
public static XmppDelay extract(Stanza stanza) throws XMLException {
	final Element x = stanza.getChildrenNS("delay", "urn:xmpp:delay");
	if (x == null)
		return null;
	return new XmppDelay(x);
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:7,代碼來源:XmppDelay.java

示例15: extract

import tigase.jaxmpp.core.client.xmpp.stanzas.Stanza; //導入方法依賴的package包/類
public static XMucUserElement extract(Stanza stanza) throws XMLException {
	final Element x = stanza == null ? null : stanza.getChildrenNS("x", "http://jabber.org/protocol/muc#user");
	if (x == null)
		return null;
	return new XMucUserElement(x);
}
 
開發者ID:horsefaced,項目名稱:jaxmpp-android,代碼行數:7,代碼來源:XMucUserElement.java


注:本文中的tigase.jaxmpp.core.client.xmpp.stanzas.Stanza.getChildrenNS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。