Package com.google.gwt.xml.client

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


    info_id++;
  }
 
  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);
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


  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();
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++)
        {
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");
View Full Code Here

    return v;
  }
 
  public boolean formXml(final String xml)
  {
    Document doc = XMLParser.parse(xml);
    Element vcardElement = XMLHelper.findSubTag(doc.getDocumentElement(), "vCard");
    if(vcardElement == null)
      return false;
   
    NodeList childs = vcardElement.getChildNodes();
    for(int index = 0;index<childs.getLength();index++)
View Full Code Here

    public static String toString(final IPacket packet) {
  return packet.toString();
    }

    public static IPacket toXML(final String xml) {
  final Document parsed = XMLParser.parse(xml);
  final Node body = parsed.getChildNodes().item(0);
  return new GWTPacket((Element) body);
    }
View Full Code Here

    this.modelType = modelType;
  }

  @SuppressWarnings({"unchecked", "rawtypes"})
  public D read(Object loadConfig, Object data) {
    Document doc = XMLParser.parse((String) data);

    NodeList list = doc.getElementsByTagName(modelType.getRecordName());
    ArrayList<ModelData> records = new ArrayList<ModelData>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      ModelData model = newModelInstance();
      for (int j = 0; j < modelType.getFieldCount(); j++) {
        DataField field = modelType.getField(j);
        Class type = field.getType();
        String name = field.getName();
        String map = field.getMap() != null ? field.getMap() : field.getName();
        String v = getValue(elem, map);
        if (v == null) continue;
        if (type != null) {
          if (type.equals(Boolean.class)) {
            model.set(name, Boolean.parseBoolean(v));
          } else if (type.equals(Integer.class)) {
            model.set(name, Integer.parseInt(v));
          } else if (type.equals(Long.class)) {
            model.set(name, Long.parseLong(v));
          } else if (type.equals(Float.class)) {
            model.set(name, Float.parseFloat(v));
          } else if (type.equals(Double.class)) {
            model.set(name, Double.parseDouble(v));
          } else if (type.equals(Date.class)) {
            if ("timestamp".equals(field.getFormat())) {
              Date d = new Date(Long.parseLong(v) * 1000);
              model.set(name, d);
            } else {
              DateTimeFormat format = DateTimeFormat.getFormat(field.getFormat());
              Date d = format.parse(v);
              model.set(name, d);
            }
          }
        } else {
          model.set(field.getName(), v);
        }

      }
      records.add(model);
    }

    int totalCount = records.size();
    Node root = doc.getElementsByTagName(modelType.getRoot()).item(0);
    if (root != null && modelType.getTotalName() != null) {
      String tot = getValue((Element) root, modelType.getTotalName());
      if (tot != null) {
        totalCount = Integer.parseInt(tot);
      }
View Full Code Here

    errorStatuses.clear();
    schemaLocations.clear();
    defaultNamespace.clear();
    otherNamespaces.clear();
   
    Document response = XMLParser.parse(serviceDataXmlString);
   
    NodeList namespaces = response.getElementsByTagName("namespace");   
    for (int i = 0; i < namespaces.getLength(); i++) {
      Node namespace = namespaces.item(i);
      if (namespace.hasChildNodes()) {
        String namespaceString = namespace.getFirstChild().getNodeValue();
        if ((!otherNamespaces.contains(namespaceString)) &&
            (!namespaceString.equals(WadlXml.xmlns_xsd)) &&
            (!namespaceString.equals(WadlXml.xmlns_xsi))) {
          otherNamespaces.add(namespaceString);
        }
      }
    }
   
    NodeList requests = response.getElementsByTagName("requestData");   
    for (int i = 0; i < requests.getLength(); i++) {
      Node request = requests.item(i);           
      NodeList requestChildren = request.getChildNodes();     
      for (int j = 0; j < requestChildren.getLength(); j++) {
        Node requestChild = requestChildren.item(j);
View Full Code Here

    wadlXmlString = wadlXmlString.replaceAll("<!--.*?-->", "");   
    try {
      // reset the application
      GuiFactory.resetApplication();
     
      Document wadl = XMLParser.parse(wadlXmlString);
     
      if (startParsing(wadl)) {
        uploadDialogBox.setVisible(true);
        uploadDialogBox.hide();
        // if the parsing succeeded render a tree from the parsed wadl   
View Full Code Here

TOP

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

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.