There is an XML template for parsing the XmlPullParser:

<XML> <client> <tag>text</tag>....<tag>text</tag> </client> <client> <tag>text</tag>....<tag>text</tag> </client> <client> <tag>text</tag>....<tag>text</tag> </client> </XML> 

I need to somehow get alternately in the while loop (string, array ... not important at the moment):

 new_clint="<client> <tag>text</tag>....<tag>text</tag> </client>" 

How can this be realized, tell me pzhl?

    1 answer 1

    Found the answer, can someone come in handy.
    Solution isp. DOM parse:

     DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new InputSource(new StringReader(data))); doc.getDocumentElement().normalize(); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); NodeList nList = doc.getElementsByTagName("client"); for (int i = 0; i < nList.getLength(); i++) { Node nNode = nList.item(i); Element eElement = (Element) nNode; System.out.println("[" + i + "] -> " + nodeToString(nList.item(i))); }