Package com.google.gwt.xml.client

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


   * {@inheritDoc }
   */
  @Override
  public Element getRootElement() throws XmlException {

    NodeList nodeList = this.document.getChildNodes();

    for (int i = 0; i < nodeList.getLength(); i++) {
      Node n = nodeList.item(i);
      if (n.getNodeType() == Node.ELEMENT_NODE) {
        Element root = (Element) n;
        return root;
      }
    }
View Full Code Here


   */
  @Override
  public List<Element> getElements(String nodeName) throws XmlException {

    ArrayList<Element> elements = new ArrayList<Element>();
    NodeList list = this.document.getElementsByTagName(nodeName);
    if (list != null) {
      for (int i = 0; i < list.getLength(); i++) {
        elements.add((Element) list.item(i));
      }
    }
    return elements;
  }
View Full Code Here

 
  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

    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;
View Full Code Here

      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

      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

          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

{
  public static Element queryTag(final Element e)
  {
    if(e == null)
      return null;
    NodeList list = e.getElementsByTagName("query");
    if(list.getLength()>0)
      return (Element) list.item(0);
    else
      return null;
  }
View Full Code Here

 
  public static Element findSubTag(final Element e,final String tagName)
  {
    if(e == null)
      return null;
    NodeList list = e.getElementsByTagName(tagName);
    if(list.getLength()>0)
      return (Element) list.item(0);
    return null;
  }
View Full Code Here

  }
 
  public static ArrayList<String> getSubTagsConents(final Element e,String tagName)
  {
    ArrayList<String> groups = new ArrayList<String>();
    NodeList list = e.getElementsByTagName(tagName);
    for(int index = 0;index<list.getLength();index++)
    {
      Element item = (Element) list.item(index);
      groups.add(item.getFirstChild().getNodeValue());
    }
    return groups;
  }
View Full Code Here

TOP

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

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.