Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.Element


  }
 
  private void onDiscoItems(final XmppPacket query)
  {
    Document doc = XMLParser.parse(query.toXML());
      Element queryEl = XMLHelper.queryTag(doc.getDocumentElement());
      NodeList items = queryEl.getChildNodes();
      disco.clear();
      for(int index = 0;index < items.getLength();index++)
      {
        Element item = (Element)items.item(index);
        if(!item.getTagName().equals("item")||item.getAttribute("jid") == null||item.getAttribute("node") != null)
          continue;
        getDiscoItemInfo(item.getAttribute("jid"));
      }
  }
View Full Code Here


 
  private void onDiscoInfo(final XmppPacket query)
  {
    final String jid = query.getFrom();
    Document doc = XMLParser.parse(query.toXML());
      Element queryEl = XMLHelper.queryTag(doc.getDocumentElement());
      disco.put(jid, queryEl);
  }
View Full Code Here

  {
    List<Service> services = new ArrayList<Service>();
    services.add(0,new Service("","Local jabber user"));
    for(String jid:disco.keySet())
    {
      Element el = disco.get(jid);
      if(el == null)
        continue;
      Node item = el.getElementsByTagName("identity").item(0);
      if(item == null)
        continue;
      Element elItem = (Element)item;
      if(elItem.getAttribute("category").equals("gateway"))
      {
        services.add(new Service(jid,elItem.getAttribute("name")));
      }
    }
    return services;
  }
View Full Code Here

  public List<Service> getSearchServices()
  {
    List<Service> services = new ArrayList<Service>();
    for(String jid:disco.keySet())
    {
      Element el = disco.get(jid);
      if(el == null)
        continue;
      NodeList items = el.getElementsByTagName("feature");
      for(int index = 0;index<items.getLength();index++)
      {
        Element item = (Element)items.item(index);
        if(item.getAttribute("var").equals("jabber:iq:search"))
        {
          Element identity = (Element) el.getElementsByTagName("identity").item(0);
          services.add(new Service(jid,identity.getAttribute("name")));
          break;
        }
      }
    }
    return services;
View Full Code Here

  public List<Service> getMUCRoomServices()
  {
    List<Service> services = new ArrayList<Service>();
    for(String jid:disco.keySet())
    {
      Element el = disco.get(jid);
      if(el == null)
        continue;
      Node item = el.getElementsByTagName("identity").item(0);
      if(item == null)
        continue;
      Element elItem = (Element)item;
      if(elItem.getAttribute("category").equals("conference")&&elItem.getAttribute("type").equals("text"))
      {
        NodeList features = el.getElementsByTagName("feature");
        for(int index=0;index<features.getLength();index++)
        {
          Element feature = (Element) features.item(index);
          if(feature.getAttribute("var").equals("http://jabber.org/protocol/muc"))
          {
            services.add(new Service(jid,elItem.getAttribute("name")));
            break;
          }
        }
View Full Code Here

  public String getNick()
  {
    String xml = toXML();
    Document doc = XMLParser.parse(xml);
    Element rootEl = doc.getDocumentElement();
    if(!rootEl.getTagName().equals("presence"))
      return "";
    Element nickEl = XMLHelper.findSubTag(rootEl, "nick");
    if(nickEl != null && nickEl.getAttribute("xmlns").equals("http://jabber.org/protocol/nick"))
      return nickEl.getNodeValue();
    return "";
  }
View Full Code Here

   
    private void parseRoster(String xml)
    {
      contacts.clear();
      Document doc = XMLParser.parse(xml);
      Element query = XMLHelper.queryTag(doc.getDocumentElement());
      if(query !=null && query.getAttribute("xmlns").equals("jabber:iq:roster"))
      {
        NodeList itemList = query.getElementsByTagName("item");
        for(int index = 0;index<itemList.getLength();index++)
        {
          Element item = (Element)itemList.item(index);
          XmppContact contact = XmppContact.fromXml(item);
          contacts.put(contact.getJID().toString(), contact);
        }
      }
      if(!contacts.isEmpty())
View Full Code Here

      public void onInfoQueryReceived(XmppPacket packet)
      {
        if(!packet.getType().equals("set")||packet.getID().equals("roster_1"))
          return;
        Document doc = XMLParser.parse(packet.toXML());
          Element query = XMLHelper.queryTag(doc.getDocumentElement());
          if(!query.getAttribute("xmlns").equals("jabber:iq:roster"))
            return;
          contacts.clear();
         
          NodeList itemList = query.getElementsByTagName("item");
          for(int index = 0;index<itemList.getLength();index++)
          {
            Element item = (Element)itemList.item(index);
            XmppContact contact = XmppContact.fromXml(item);
            contacts.put(contact.getJID().toString(), contact);
          }
          if(!contacts.isEmpty())
            JabberApp.instance().pushRosterIncoming(contacts);
View Full Code Here

    return null;
  }
 
  public static boolean hasSubTag(final Element e,final String name)
  {
    Element find = findSubTag(e,name);
    if(find!=null)
      return true;
    else
      return false;
  }
View Full Code Here

      return false;
  }
 
  public static String queryNS(final Element e)
  {
    Element queryElement = queryTag(e);
    if(queryElement != null)
      return queryElement.getAttribute("xmlns");
    else
      return "";
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.Element

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.