Below is an extract from my code
Document doc = loadXMLFromString(httpPostJava());
NodeList list = doc.getElementsByTagName("*");
int bookCount = 0;
for (int i = 0; i < list.getLength(); i++) {
Element element = (Element)list.item(i);
String nodeName = element.getNodeName();
if (nodeName.equals("assd") ||nodeName.equals("eventy")) {
System.out.println(("\t"+nodeName+"\t" element.getChildNodes().item(0).getNodeValue()));
}
The problem i have is that i want the output from the "assd" node and the "eventy" node to be side by side in the console output. Currently it is being printed underneath the "assd" node and this because the the if statement is finding the "assd" node printing out the data and the loop runs again now outputting to the line below. I am fairly new to Java well 6 months of exposure.
Output i am hoping should like assd eventy data data1
Aucun commentaire:
Enregistrer un commentaire