Have this soap message
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<BRANCH xmlns="https://ya.yandex.ru/get-instance">
<mtu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<header>
<MANE>032036</MANE>
<TYPE>GET</TYPE>
</header>
<body>
<BR_CODE>666</BR_CODE>
<NAME>hello</NAME>
<ADDRESS>USA</ADDRESS>
<IS_ACTIVE>true</IS_ACTIVE>
</body>
</BRANCH>
</soapenv:Body>
</soapenv:Envelope>
I want to get only this. With tags:
<BR_CODE>666</BR_CODE>
<NAME>hello</NAME>
<ADDRESS>USA</ADDRESS>
<IS_ACTIVE>true</IS_ACTIVE>
But i have this in output :
666 hello USA true
There is my code
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse((new InputSource(new StringReader(response))));
doc.getDocumentElement().normalize();
NodeList list = doc.getElementsByTagName("body");
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
System.out.println(node.getTextContent());
}
Whats wrong in my code? Can not get what i want.