/** * Process Message from server * * @param doc */ private void _message(Document doc) { Element root = doc.getRootElement(); Element message = root.getChild("message"); String sender = message.getChild("sender").getText(); String mesg = message.getChild("mesg").getText(); sendMessage(NORMAL, sender + ": " + mesg); }
/** * Processes the messages from the server * * @param message */ private synchronized void processServerMessage(String message) { SAXBuilder builder = new SAXBuilder(); String what = new String(); Document doc = null; try { doc = builder.build(new StringReader(message)); Element root = doc.getRootElement(); List childs = root.getChildren(); Iterator i = childs.iterator(); what = ((Element) i.next()).getName(); } catch (Exception e) { } if (what.equalsIgnoreCase("LOGIN") == true) _login(doc); else if (what.equalsIgnoreCase("LOGOUT") == true) _logout(doc); else if (what.equalsIgnoreCase("MESSAGE") == true) _message(doc); else if (what.equalsIgnoreCase("WALL") == true) _wall(doc); else if (what.equalsIgnoreCase("CREATEGROUP") == true) _creategroup(doc); else if (what.equalsIgnoreCase("JOINGROUP") == true) _joingroup(doc); else if (what.equalsIgnoreCase("PARTGROUP") == true) _partgroup(doc); else if (what.equalsIgnoreCase("GROUPMESSAGE") == true) _groupmessage(doc); else if (what.equalsIgnoreCase("KICK") == true) _kick(doc); else if (what.equalsIgnoreCase("LISTUSER") == true) _listuser(doc); else if (what.equalsIgnoreCase("LISTGROUP") == true) _listgroup(doc); }
/** * Process kick from server * * @param doc */ private void _kick(Document doc) { Element root = doc.getRootElement(); Element kick = root.getChild("kick"); String user = kick.getChild("user").getText(); String answer = kick.getChild("answer").getText(); if (answer.equals("OK") == true) sendMessage(SERVER, user + " was kicked from " + _group); }
public static void main(String[] args) throws Exception { // final Logger log = Logger.getLogger(sample.class.getCanonicalName()); JobData jd = new JobData(); Scanner input = new Scanner(System.in); try { System.out.print("What is your user name? "); jd.setUsername(input.next()); System.out.print("What is your password? "); jd.setPassword(input.next()); } catch (Exception e) { // log.log(Level. SEVERE, "The system encountered an exception while attempting to login"); } finally { input.close(); } jd.setJob("TestREST"); jd.setServer("http://10.94.0.137"); jd.setPort("8006"); URL url = new URL("http://10.94.0.137:8006/api/xml"); Document dom = new SAXReader().read(url); for (Element job : (List<Element>) dom.getRootElement().elements("job")) { System.out.println( String.format( "Job %s with URL %s has status %s", job.elementText("name"), job.elementText("url"), job.elementText("color"))); } }
public boolean read(String strRoute, String strElement, int flag) { //SAXBuilder builder=new SAXBuilder(); strText = null; try { String[] route = new String[4]; String str = null; Document doc = builder.build(xmlFileName); Element root = doc.getRootElement(); Element element = root; //创建一个拆分字符串内容的对象,每次返回一项 StringTokenizer st = new StringTokenizer(strRoute, ":"); str = st.nextToken(); while (st.hasMoreTokens()) { str = st.nextToken(); element = element.getChild(str); } //mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,str); element = (Element) element.getParent(); /* * while(flag!=1) { if(element.removeChild(str)) * mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,"deleted "+str); * else mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,"not * deleted"); * * flag--; } */ // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,element.getName()); strText = element.getChild(str).getChild(strElement).getText(); } catch (JDOMException jdome) { mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, xmlFileName + " is not well-formed"); } catch (IOException ioe) { mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, ioe); } catch (NullPointerException nullpe) { mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, "not founded" + "\n" + nullpe); } catch (Exception e) { mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, "read no succeed" + "\n" + e); } if (strText == null) { mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, "not founded"); return false; } else { // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,"strText="+strText); return true; } }
/** * Process Partgroup from server * * @param doc */ private void _partgroup(Document doc) { Element root = doc.getRootElement(); Element part = root.getChild("partgroup"); String group = part.getChild("group").getText(); String answer = part.getChild("answer").getText(); if (group.equals(_group) == true) { sendMessage(SERVER, group + ": " + answer); } }
private QueryResult gatherResultInfoForSelectQuery( String queryString, int queryNr, boolean sorted, Document doc, String[] rows) { Element root = doc.getRootElement(); // Get head information Element child = root.getChild("head", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#")); // Get result rows (<head>) List headChildren = child.getChildren( "variable", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#")); Iterator it = headChildren.iterator(); ArrayList<String> headList = new ArrayList<String>(); while (it.hasNext()) { headList.add(((Element) it.next()).getAttributeValue("name")); } List resultChildren = root.getChild("results", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#")) .getChildren( "result", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#")); int nrResults = resultChildren.size(); QueryResult queryResult = new QueryResult(queryNr, queryString, nrResults, sorted, headList); it = resultChildren.iterator(); while (it.hasNext()) { Element resultElement = (Element) it.next(); String result = ""; // get the row values and paste it together to one String for (int i = 0; i < rows.length; i++) { List bindings = resultElement.getChildren( "binding", Namespace.getNamespace("http://www.w3.org/2005/sparql-results#")); String rowName = rows[i]; for (int j = 0; j < bindings.size(); j++) { Element binding = (Element) bindings.get(j); if (binding.getAttributeValue("name").equals(rowName)) if (result.equals("")) result += rowName + ": " + ((Element) binding.getChildren().get(0)).getTextNormalize(); else result += "\n" + rowName + ": " + ((Element) binding.getChildren().get(0)).getTextNormalize(); } } queryResult.addResult(result); } return queryResult; }
/** * Process Groupmessage from server * * @param doc */ private void _groupmessage(Document doc) { Element root = doc.getRootElement(); Element message = root.getChild("groupmessage"); String group = message.getChild("group").getText(); String sender = message.getChild("sender").getText(); String mesg = message.getChild("mesg").getText(); if (group.equals(_group) == true) { sendMessage(NORMAL, group + "(" + sender + "): " + mesg); } }
/** * Process Creategroup from server * * @param doc */ private void _creategroup(Document doc) { Element root = doc.getRootElement(); Element create = root.getChild("creategroup"); String group = create.getChild("group").getText(); String answer = create.getChild("answer").getText(); sendMessage(SERVER, "Group creation is: " + answer); if (answer.equals("OK") == true) { sendMessage(SERVER, "Group " + group + " joined."); _group = group; } }
/** * Process Joingroup from server * * @param doc */ private void _joingroup(Document doc) { Element root = doc.getRootElement(); Element join = root.getChild("joingroup"); String group = join.getChild("group").getText(); String answer = join.getChild("answer").getText(); sendMessage(SERVER, "JoinGroup: " + answer); if (answer.equals("OK") == true) { sendMessage(SERVER, "Group " + group + " joined."); _group = group; } }
/** * Método public static void leerArchivoXML(ListaUsuarios listaDeUsuarios): Este método permite * leer un archivo XML que contiene los datos de los usuarios a través de jdom */ public static void leerArchivoXML(ListaUsuario listaDeUsuarios) { try { SAXBuilder builder = new SAXBuilder(); /* Se crea un documento nuevo con el nombre del archivo */ Document doc = builder.build(nombreArchivo); /* Se obtiene la raíz del archivo (la etiqueta inicial) */ Element raiz = doc.getRootElement(); /* Se puede obtener el atributo de la raíz (de la etiqueta) */ System.out.println(raiz.getAttributeValue("tipo")); /* Se obtienen todos los hijos cuya etiqueta esa "usuario" */ /* y se asignan esos hijos a un List */ List listaUsuarios = raiz.getChildren("usuario"); System.out.println("Formada por:" + listaUsuarios.size() + " usuarios"); System.out.println("------------------"); /* Se genera un iterador para recorrer el List que se generó */ Iterator i = listaUsuarios.iterator(); /* Se recorre el List */ while (i.hasNext()) { /* Se obtiene cada uno y se asigna a un objeto de tipo Element */ Element e = (Element) i.next(); /* Se obtiene el nombre, apellido y cargo de cada una de las etiquetas */ /* hijas de usuario, es decir, nombre, apellido y cargo */ Element nick = e.getChild("nick"); Element clave = e.getChild("clave"); Element nombre = e.getChild("nombre"); Element apellido = e.getChild("apellido"); Element fechanac = e.getChild("fechanac"); Element avatar = e.getChild("avatar"); /* Se crea un nodo nuevo con la información y se agrega a la lista de usuarios */ Usuario elUsuario = new Usuario( nick.getText(), clave.getText(), nombre.getText(), apellido.getText(), fechanac.getText(), avatar.getText()); listaDeUsuarios.AgregarElemento(elUsuario); } } catch (Exception e) { e.printStackTrace(); } }
/** Create a new step from an in-line XML string. */ public static Step createStep(Resolver resolver, String str) throws InvalidScriptException, IOException { StringReader reader = new StringReader(str); try { SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(reader); Element el = doc.getRootElement(); return createStep(resolver, el); } catch (JDOMException e) { throw new InvalidScriptException(e.getMessage()); } }
/** * Process listuser from server * * @param doc */ private void _listuser(Document doc) { StringBuffer userlist = new StringBuffer(); Element root = doc.getRootElement(); Element list = root.getChild("listuser"); List users = list.getChildren("user"); Iterator i = users.iterator(); while (i.hasNext()) { userlist.append(((Element) i.next()).getText()); userlist.append("\n"); } sendMessage(SERVER, "Users: \n" + userlist); }
public Document serialize(Object object, Document doc) { Class c = object.getClass(); Integer id = getID(object); map.put(object, id); String mapSize = Integer.toString(map.size()); // creating serialization objects Element objectElement = new Element("object"); objectElement.setAttribute(new Attribute("class", c.getName())); objectElement.setAttribute(new Attribute("id", mapSize)); doc.getRootElement().addContent(objectElement); if (!c.isArray()) // class is not an array { Field[] fields = c.getDeclaredFields(); ArrayList<Element> fieldXML = serializeFields(fields, object, doc); for (int i = 0; i < fieldXML.size(); i++) { objectElement.addContent(fieldXML.get(i)); } } else // class is an array { Object array = object; objectElement.setAttribute(new Attribute("length", Integer.toString(Array.getLength(array)))); if (c.getComponentType().isPrimitive()) // class is array of primitives { for (int i = 0; i < Array.getLength(array); i++) { Element value = new Element("value"); value.setText(Array.get(c, i).toString()); objectElement.addContent(value); } } else // class is array of references { for (int j = 0; j < Array.getLength(array); j++) { Element ref = new Element("reference"); id = getID(Array.get(c, j)); if (id != -1) { ref.setText(Integer.toString(id)); } } for (int k = 0; k < Array.getLength(array); k++) { serialize(Array.get(array, k), doc); } } } if (currentElement == 0) { referenceID = 0; } return doc; }
/** * Process listgroup from server * * @param doc */ private void _listgroup(Document doc) { StringBuffer grouplist = new StringBuffer(); Element root = doc.getRootElement(); Element list = root.getChild("listgroup"); List groups = list.getChildren("group"); Iterator i = groups.iterator(); while (i.hasNext()) { Element temp = (Element) i.next(); grouplist.append(temp.getChild("name").getText()); grouplist.append("\t"); grouplist.append(temp.getChild("description").getText()); grouplist.append("\n"); } sendMessage(SERVER, "Groups: \n" + grouplist); }
// Empieza La Carga de la Partida public static void leerArchivoXML(ListaPartida listaDePartidas) { try { SAXBuilder builder = new SAXBuilder(); /* Se crea un documento nuevo con el nombre del archivo */ Document doc = builder.build(nombreArchivoPartida); /* Se obtiene la raíz del archivo (la etiqueta inicial) */ Element raiz = doc.getRootElement(); /* Se puede obtener el atributo de la raíz (de la etiqueta) */ System.out.println(raiz.getAttributeValue("tipo")); /* Se obtienen todos los hijos cuya etiqueta esa "usuario" */ /* y se asignan esos hijos a un List */ List listaPartida = raiz.getChildren("partida"); System.out.println("Formada por:" + listaPartida.size() + " Partidas"); System.out.println("------------------"); /* Se genera un iterador para recorrer el List que se generó */ Iterator i = listaPartida.iterator(); /* Se recorre el List */ while (i.hasNext()) { /* Se obtiene cada uno y se asigna a un objeto de tipo Element */ Element e = (Element) i.next(); /* Se obtiene el nombre, apellido y cargo de cada una de las etiquetas */ /* hijas de usuario, es decir, nombre, apellido y cargo */ Element nick = e.getChild("Usuario"); Element ID = e.getChild("ID"); Element fechaactual = e.getChild("fechaacual"); Element fechainicio = e.getChild("fechainicio"); /* Se crea un nodo nuevo con la información y se agrega a la lista de usuarios */ Partida laPartida = new Partida( nick.getText(), ID.getContentSize(), fechaactual.getText(), fechainicio.getText()); listaDePartidas.AgregarElemento(laPartida); } } catch (Exception e) { e.printStackTrace(); } }
/** * * @param 普通版list 参数列表 */ public void writeptParaList(ArrayList list) { try { String sCaseName=""; String sItem=""; String sCycName=""; HashMap map=null; Document doc = builder.build(xmlFileName); Element root = doc.getRootElement(); Element element = root; Element cycNode=null; map=(HashMap)list.get(0); //参数文件map sItem="Description"; sCaseName=(String)map.get(sItem); mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, "Description=" + sCaseName ); sItem="CysName"; sCycName=(String)map.get(sItem); map=(HashMap)list.get(1); //public 参数map cycNode=writeptPublicNode(element,map,sCycName); if( writeCycNode(cycNode,list)==false) //循环 参数 System.err.println(" write cyc node fail"); XMLOutputter outputter = new XMLOutputter("", false, "GB2312"); PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter(xmlFileName))); Document myDocument = root.getDocument(); outputter.output(myDocument, out); out.close(); } catch (JDOMException jdome) { jdome.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
/** * Simple parsing and display of the response. This method uses dom4j for parsing XML, feel free * to use anything that comes handy. */ @SuppressWarnings("unchecked") private static void displayResults(InputStream results) throws IOException { try { final SAXReader reader = new SAXReader(); final Document document = reader.read(results); final Iterator<Element> i = document.getRootElement().elementIterator("group"); while (i.hasNext()) { final Element group = i.next(); display(group, 1); } System.out.println(); } catch (DocumentException e) { throw new IOException("Could not parse response: " + e.getMessage()); } finally { if (results != null) { results.close(); } } }
/** * This will output the <code>JDOM Document</code>, firing off the SAX events that have been * registered. * * @param document <code>JDOM Document</code> to output. * @throws JDOMException if any error occurred. */ public void output(Document document) throws JDOMException { if (document == null) { return; } // contentHandler.setDocumentLocator() documentLocator(document); // contentHandler.startDocument() startDocument(); // Fire DTD events if (this.reportDtdEvents) { dtdEvents(document); } // Handle root element, as well as any root level // processing instructions and comments Iterator i = document.getContent().iterator(); while (i.hasNext()) { Object obj = i.next(); // update locator locator.setNode(obj); if (obj instanceof Element) { // process root element and its content element(document.getRootElement(), new NamespaceStack()); } else if (obj instanceof ProcessingInstruction) { // contentHandler.processingInstruction() processingInstruction((ProcessingInstruction) obj); } else if (obj instanceof Comment) { // lexicalHandler.comment() comment(((Comment) obj).getText()); } } // contentHandler.endDocument() endDocument(); }
//改写XML文件的某一元素的值 //strRoute为XML文件从根元素开始到该元素的父元素的路径 //strElement为需要读取的元素 //flag为当XML含有多个同名元素时,需要改写元素所处的序号 public void write(String strRoute, String strElement, String strSet, int flag) { //SAXBuilder builder=new SAXBuilder(); try { String str = null; Document doc = builder.build(xmlFileName); Element root = doc.getRootElement(); Element element = root; StringTokenizer st = new StringTokenizer(strRoute, ":"); str = st.nextToken(); while (st.hasMoreTokens()) { str = st.nextToken(); //mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,str); element = element.getChild(str); } // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,"test :"+str); element = (Element) element.getParent(); //若需要改写的不是XML文件的第一个同名元素,则获取该元素 //方法为:将之前的元素依次移到后面,需要改写的元素前移至第一个 /* * if(flag>1) { int j=flag; while(j!=1) { * * Element tmp=element.getChild(str); * element.addContent(tmp.detach()); j--; } } */ element = element.getChild(str).getChild(strElement); // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP,"gettxt // "+element.getText()); element.setText(strSet); //若需要改写的不是XML文件的第一个同名元素 //上面改变了次序,需要在成功改写后恢复原有次序 /* * if(flag!=1) { * * java.util.List children=element.getChildren(); Iterator * iterator=children.iterator(); int count=0; * while(iterator.hasNext()) { Element * child=(Element)iterator.next(); count++; } * * System.out.println("count"+count); * * k=(count+1-flag)%count; * * while(k!=0) { Element tmp=element.getChild(str); * element.addContent(tmp.detach()); k--; } } * */ XMLOutputter outputter = new XMLOutputter("", false, "GB2312"); PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter(xmlFileName))); Document myDocument = root.getDocument(); outputter.output(myDocument, out); out.close(); } catch (JDOMException jdome) { jdome.printStackTrace(); // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, xmlFileName // + " is not well-formed\n"); } catch (IOException ioe) { ioe.printStackTrace(); // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, ioe); } catch (Exception e) { e.printStackTrace(); // mypage.FcfeMain.wR(mypage.FcfeMain.SIM_APP_ERP, // "write not succeed\n"); } }
public void annotate(CoreMap document) throws IOException { // write input file in GUTime format Element inputXML = toInputXML(document); File inputFile = File.createTempFile("gutime", ".input"); // Document doc = new Document(inputXML); PrintWriter inputWriter = new PrintWriter(inputFile); inputWriter.println(inputXML.toXML()); // new XMLOutputter().output(inputXML, inputWriter); inputWriter.close(); boolean useFirstDate = (!document.has(CoreAnnotations.CalendarAnnotation.class) && !document.has(CoreAnnotations.DocDateAnnotation.class)); ArrayList<String> args = new ArrayList<String>(); args.add("perl"); args.add("-I" + this.gutimePath.getPath()); args.add(new File(this.gutimePath, "TimeTag.pl").getPath()); if (useFirstDate) args.add("-FDNW"); args.add(inputFile.getPath()); // run GUTime on the input file ProcessBuilder process = new ProcessBuilder(args); StringWriter outputWriter = new StringWriter(); SystemUtils.run(process, outputWriter, null); String output = outputWriter.getBuffer().toString(); Pattern docClose = Pattern.compile("</DOC>.*", Pattern.DOTALL); output = docClose.matcher(output).replaceAll("</DOC>"); // parse the GUTime output Element outputXML; try { Document newNodeDocument = new Builder().build(output, ""); outputXML = newNodeDocument.getRootElement(); } catch (ParsingException ex) { throw new RuntimeException( String.format( "error:\n%s\ninput:\n%s\noutput:\n%s", ex, IOUtils.slurpFile(inputFile), output)); } /* try { outputXML = new SAXBuilder().build(new StringReader(output)).getRootElement(); } catch (JDOMException e) { throw new RuntimeException(String.format("error:\n%s\ninput:\n%s\noutput:\n%s", e, IOUtils.slurpFile(inputFile), output)); } */ inputFile.delete(); // get Timex annotations List<CoreMap> timexAnns = toTimexCoreMaps(outputXML, document); document.set(TimexAnnotations.class, timexAnns); if (outputResults) { System.out.println(timexAnns); } // align Timex annotations to sentences int timexIndex = 0; for (CoreMap sentence : document.get(CoreAnnotations.SentencesAnnotation.class)) { int sentBegin = beginOffset(sentence); int sentEnd = endOffset(sentence); // skip times before the sentence while (timexIndex < timexAnns.size() && beginOffset(timexAnns.get(timexIndex)) < sentBegin) { ++timexIndex; } // determine times within the sentence int sublistBegin = timexIndex; int sublistEnd = timexIndex; while (timexIndex < timexAnns.size() && sentBegin <= beginOffset(timexAnns.get(timexIndex)) && endOffset(timexAnns.get(timexIndex)) <= sentEnd) { ++sublistEnd; ++timexIndex; } // set the sentence timexes sentence.set(TimexAnnotations.class, timexAnns.subList(sublistBegin, sublistEnd)); } }
/** * 设置默认值 * * @param dv * @param formName * @param actionType * @return */ private S_FrameWork_Query_OperationValueObject setDefault( S_FrameWork_Query_OperationValueObject valueObject, String formName, String actionType) { String entityName = "S_FrameWork_Query_Operation"; // 代码自动生成 Document doc = DomService.getXMLDocFromEntity(entityName, formName); // 1.遍历所有节点,判断是否有默认设置 // 2.比较actionType,看是否当前默认设置的操作 // 3.反射设置当前属性的默认值 try { if (doc == null) { return valueObject; } String methordName = ""; Element root = doc.getRootElement(); java.util.List elements = root.getChildren("item"); Element tempElm = null; String s = null; String sType = "string"; String sDBType = "String"; DefaultValue dv = new DefaultValue(); String whendefault = ""; String defaultValue = ""; for (int i = 0; i < elements.size(); i++) { tempElm = (Element) elements.get(i); s = tempElm.getAttribute("name").getValue(); methordName = "set" + s.substring(0, 1).toUpperCase() + s.substring(1, s.length()); if ((tempElm.getAttribute("datatype") != null && tempElm.getAttribute("datatype").getValue() != null)) { if (tempElm.getAttribute("dbtype") == null) { sType = tempElm.getAttribute("datatype").getValue(); } else { sType = tempElm.getAttribute("dbtype").getValue(); } } // 设置缺省值;当新增加的时候,设置缺省值,此处只在初始化和load的时候设置;修改的时候不设置 // updated by wzp 20050323 if (tempElm.getAttribute("datatype") != null && tempElm.getAttribute("default") != null && tempElm.getAttribute("whendefault") != null) { whendefault = tempElm.getAttribute("whendefault").getValue(); defaultValue = tempElm.getAttribute("default").getValue(); // 如何判断是新增? if (actionType.toLowerCase().indexOf("init_") == 0 && whendefault.toLowerCase().indexOf("init") > -1) { // 初始化 valueObject = this.invokeMethord(valueObject, methordName, sType, defaultValue); } else if (actionType.toLowerCase().indexOf("create_") == 0 && whendefault.toLowerCase().indexOf("create") > -1) { // 创建 valueObject = this.invokeMethord(valueObject, methordName, sType, defaultValue); } else if (actionType.toLowerCase().indexOf("save_") == 0 && whendefault.toLowerCase().indexOf("save") > -1) { // 修改 valueObject = this.invokeMethord(valueObject, methordName, sType, defaultValue); } } } } catch (Exception exe) { exe.printStackTrace(); } return valueObject; }
/** * Process Logout from server * * @param doc */ private void _logout(Document doc) { Element root = doc.getRootElement(); Element logout = root.getChild("logout"); String answer = logout.getChild("answer").getText(); sendMessage(SERVER, "Logout is: " + answer); }
/** * Process Wall from server * * @param doc */ private void _wall(Document doc) { Element root = doc.getRootElement(); Element wall = root.getChild("wall"); String mesg = wall.getChild("mesg").getText(); sendMessage(SERVER, mesg); }