Bonjour,
avec ce code, j'ai un null pointer exception sur l'instruction à l'intérieur de la boucle (et le println affiche les bonne infos) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public void startElement(String arg0, String tagName, String arg2, Attributes attributes) throws SAXException 
	{
		// TODO Auto-generated method stub
		System.out.println("tagName et attributes.getLength()" + tagName + " " + attributes.getLength());
		if(tagName == "tex")
		{
			 for (int index = 0; index < attributes.getLength(); index++) 
			 { // on parcourt la liste des attributs
				 MainDisplay.texture.put(attributes.getLocalName(index), attributes.getValue(index));
			 }
		}
 
 
	}
MOn fichier xml est le suivant (j'utilise un DTD mais je ne sais pas si c'est obligatoire):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tex SYSTEM "http://www.../mondtd.dtd"> 
 
    <tex name="1" url="http://www.../dark_blue.jpg"> </tex>
    <tex name="2" url="http://www.../ground.jpg"> </tex>
le DTD :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
<?xml version="1.0" encoding="iso-8859-1" ?>
 
<!ELEMENT tex (name,url) >
<!ELEMENT name (#PCDATA) >
<!ELEMENT url (#PCDATA) >