J'ai un souci, avec DOM, la méthode getTextContent foctionne très bien en projet java simple. Mais sur Android ça plante quand je fais :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
try {
 
				  File file = new File(incidentsInSD);
				  DocumentBuilderFactory dbf = 
				  DocumentBuilderFactory.newInstance();
				  DocumentBuilder db = dbf.newDocumentBuilder();
				  Document document = db.parse(file);
				  document.getDocumentElement().normalize();
 
				  NodeList node = document.getElementsByTagName("incidents");
 
				  Node nodee = node.item(0);
 
				 Element el = (Element) nodee;
 
				 NodeList NombreMenus = el.getElementsByTagName("menu");
 
				 Node nodeee = NombreMenus.item(0);
 
				 Element ell = (Element) nodeee;
 
				NamedNodeMap nnm = ell.getAttributes();
 
				Node s = nnm.getNamedItem("nom");
 
				String s2 = s.getTextContent(); // Affichage dans TextView
 
				AfficheInfos.setText((CharSequence) s);
 
 
 
 
 
			 } catch (Exception e) {
				    e.printStackTrace();
				  }