Department of Mathematics and Computer Sciencewww.univ-soukahras.dz/en/dept/mi |
2 votes
|
this is y code try { File file = new File("/C:/Users/workspacememoire12/aaaaa/src/aaaaa/class.xml"); Document doc = dBuilder.parse(file); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); if (doc.hasChildNodes()) { printNote(doc.getChildNodes()); } } catch (Exception e) { private static void printNote(NodeList nodeList) { for (int count = 0; count < nodeList.getLength(); count++) { Node tempNode = nodeList.item(count); // make sure it's element node. // get node name and value if (tempNode.hasAttributes()) { // get attributes names and values for (int i = 0; i < nodeMap.getLength(); i++) { Node node = nodeMap.item(i); } } if (tempNode.hasChildNodes()) { // loop again if has child nodes } System.out.println("Node Name =" + tempNode.getNodeName() + " [CLOSE]");
} } this code shown the resut in the consol but a need it in File
|
Asked on 14:56, Sunday 8 May 2016 By Meiem Amirat (9 points) |
answers (2)
Answer (1)
-2 votes
|
public class NewMain1 { |
Answered on 17:40, Friday 20 May 2016 by Mouadh Bekhouche (17 points) |
Answer (2)
1 votes
|
jjust put those lines in the main File file2 = new File("C:\\Users\\ADMIN\\workspace\\MyProject\\file02.xml"); |
Answered on 19:05, Saturday 21 May 2016 by bendjebbqr hanane (2 points) |