Package tigase.xml

Examples of tigase.xml.Element.addChild()


  public static Element createIqQuery(final String from, final String to,
    final StanzaType type, final String id, final Element query) {
    Element iq = new Element("iq",
      new String[] {"from", "to", "type", "id"},
      new String[] {from, to, type.toString(), id});
    iq.addChild(query);
    return iq;
  }

} // ElementUtils
View Full Code Here


      query = new Element("query",
        new String[] {"xmlns"},
        new String[] {"http://jabber.org/protocol/disco#info"});
      if (identities != null) {
        for (ServiceIdentity ident: identities) {
          query.addChild(ident.getElement());
        }
      }
      if (features != null) {
        for (String feature: features) {
          query.addChild(new Element("feature",
View Full Code Here

          query.addChild(ident.getElement());
        }
      }
      if (features != null) {
        for (String feature: features) {
          query.addChild(new Element("feature",
              new String[] {"var"},
              new String[] {feature}));
        }
      }
    } else {
View Full Code Here

    parser.parse(domHandler, data.toCharArray(), 0, data.length());
    Queue<Element> elems = domHandler.getParsedElements();
    Packet result = packet.okResult((Element)null, 1);
    Element query = result.getElement().findChild("/iq/query");
    for (Element el: elems) {
      query.addChild(el);
    } // end of for (Element el: elems)
    return result;
  }

}
View Full Code Here

  public static Element clusterElement(String from, String to, StanzaType type) {
    Element cluster_el = new Element(CLUSTER_EL_NAME,
      new String[] {"from", "to", "type"},
      new String[] {from, to, type.toString()});
    cluster_el.setXMLNS(XMLNS);
    cluster_el.addChild(new Element(CLUSTER_CONTROL_EL_NAME,
        new Element[] {new Element(VISITED_NODES_EL_NAME)}, null, null));
    return cluster_el;
  }

  public static Element createClusterElement(String from, String to,
View Full Code Here

  }

  public static Element createClusterElement(String from, String to,
    StanzaType type, String packet_from) {
    Element cluster_el = clusterElement(from, to, type);
    cluster_el.addChild(new Element(CLUSTER_DATA_EL_NAME));
//         new String[] {PACKET_FROM_ATTR_NAME}, new String[] {packet_from}));
    return cluster_el;
  }

  public static ClusterElement createClusterMethodCall(String from, String to,
View Full Code Here

    Element cluster_el = clusterElement(from, to, type);
    Element method_call = new Element(CLUSTER_METHOD_EL_NAME,
      new String [] {CLUSTER_NAME_ATTR}, new String[] {method_name});
    if (params != null) {
      for (Map.Entry<String, String> entry: params.entrySet()) {
        method_call.addChild(new Element(CLUSTER_METHOD_PAR_EL_NAME,
            entry.getValue(),
            new String[] {CLUSTER_NAME_ATTR}, new String[] {entry.getKey()}));
      }
    }
    cluster_el.findChild(CLUSTER_CONTROL_PATH).addChild(method_call);
View Full Code Here

    Element res = elem.findChild(CLUSTER_METHOD_RESULTS_PATH);
    if (res == null) {
      res = new Element(CLUSTER_METHOD_RESULTS_EL_NAME);
      elem.findChild(CLUSTER_METHOD_PATH).addChild(res);
    }
    res.addChild(new Element(CLUSTER_METHOD_RESULTS_VAL_EL_NAME, val,
        new String[] {CLUSTER_NAME_ATTR}, new String[] {key}));
    if (method_results == null) {
      method_results = new LinkedHashMap<String, String>();
    }
    method_results.put(key, val);
View Full Code Here

          new String[] {"type", "id", "to"},
          new String[] {"set", "dr-"+items.size(), session.getJID()});
        Element query = new Element("query");
        query.setXMLNS(XMLNS);
        iq.addChild(query);
        query.addChild(items.poll());
        while (query.getChildren().size() < 20 && items.size() > 0) {
          query.addChild(items.poll());
        }
        Packet rost_res = new Packet(iq);
        rost_res.setTo(session.getConnectionId());
View Full Code Here

        Element query = new Element("query");
        query.setXMLNS(XMLNS);
        iq.addChild(query);
        query.addChild(items.poll());
        while (query.getChildren().size() < 20 && items.size() > 0) {
          query.addChild(items.poll());
        }
        Packet rost_res = new Packet(iq);
        rost_res.setTo(session.getConnectionId());
        rost_res.setFrom(packet.getTo());
        results.offer(rost_res);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.