Package tigase.xml

Examples of tigase.xml.DomBuilderHandler


    } // end of try-catch

  }

  private Packet parseXMLData(String data, Packet packet) {
    DomBuilderHandler domHandler = new DomBuilderHandler();
    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)
View Full Code Here


    return false;
  }

  public Queue<Packet> restorePacketForOffLineUser(XMPPResourceConnection conn)
    throws NotAuthorizedException, TigaseDBException {
    DomBuilderHandler domHandler = new DomBuilderHandler();
    String[] msgs = conn.getOfflineDataList(ID, "messages");
    if (msgs != null && msgs.length > 0) {
      conn.removeOfflineData(ID, "messages");
      LinkedList<Packet> pacs = new LinkedList<Packet>();
      StringBuilder sb = new StringBuilder();
      for (String msg: msgs) {
        sb.append(msg);
      }
      char[] data = sb.toString().toCharArray();
      parser.parse(domHandler, data, 0, data.length);
      Queue<Element> elems = domHandler.getParsedElements();
      Element elem = null;
      while ((elem = elems.poll()) != null) {
        pacs.offer(new Packet(elem));
      } // end of while (elem = elems.poll() != null)
      try {
View Full Code Here

    } // end of try-catch

  }

  private Packet parseXMLData(String data, Packet packet) {
    DomBuilderHandler domHandler = new DomBuilderHandler();
    parser.parse(domHandler, data.toCharArray(), 0, data.length());
    Queue<Element> elems = domHandler.getParsedElements();
    Packet result = packet.okResult((Element)null, 0);
    for (Element el: elems) {
      result.getElement().addChild(el);
    } // end of for (Element el: elems)
    return result;
View Full Code Here

    super.reload();
    try {
      // It is now time to load all VHost settings from the database:
      String vhosts_list = repo.getData(vhost_user, vhost_list_pkey);
      if (vhosts_list != null && !vhosts_list.isEmpty()) {
        DomBuilderHandler domHandler = new DomBuilderHandler();
        SimpleParser parser = SingletonFactory.getParserInstance();
        parser.parse(domHandler, vhosts_list.toCharArray(), 0,
                vhosts_list.length());
        Queue<Element> elems = domHandler.getParsedElements();
        if (elems != null && elems.size() > 0) {
          for (Element elem : elems) {
            VHostItem item = new VHostItem(elem);
            vhosts.put(item.getVhost(), item);
          }
View Full Code Here

    Map<String, RosterElement> roster = new LinkedHashMap<String, RosterElement>();
    session.putSessionData(ROSTER, roster);
    String roster_str = session.getData(null, ROSTER, null);
    log.finest("Loaded user roster: " + roster_str);
    if (roster_str != null && !roster_str.isEmpty()) {
      DomBuilderHandler domHandler = new DomBuilderHandler();
      parser.parse(domHandler, roster_str.toCharArray(), 0, roster_str.length());
      Queue<Element> elems = domHandler.getParsedElements();
      if (elems != null && elems.size() > 0) {
        for (Element elem: elems) {
          RosterElement relem = new RosterElement(elem);
          roster.put(relem.getJid(), relem);
        }
View Full Code Here

    log.finest("Loading privacy list: " + list);
    String lNode = listNode(list);
    String list_str = session.getData(lNode, PRIVACY_LIST, null);
    if (list_str != null && !list_str.isEmpty()) {
      SimpleParser parser = SingletonFactory.getParserInstance();
      DomBuilderHandler domHandler = new DomBuilderHandler();
      parser.parse(domHandler, list_str.toCharArray(), 0, list_str.length());
      Queue<Element> elems = domHandler.getParsedElements();
      Element result = elems.poll();
      log.finest("Loaded privacy list: " + result.toString());
      return result;
    } else {
      return getListOld(session, list);
View Full Code Here

  public void handleStanzas(Queue<Packet> results) {
    addOutPackets(results);
  }

  private void parseXMLData(String data) {
    DomBuilderHandler domHandler = new DomBuilderHandler();
    parser.parse(domHandler, data.toCharArray(), 0, data.length());
    Queue<Element> elems = domHandler.getParsedElements();
    while (elems != null && elems.size() > 0) {
      Packet result = new Packet(elems.poll());
      addOutPacket(result);
    }
  }
View Full Code Here

TOP

Related Classes of tigase.xml.DomBuilderHandler

Copyright © 2018 www.massapicom. 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.