Parser sax

Résolu
helloworld95 -  
 helloworld95 -
Bonjour,

Je n'arrive pas à trouver les attributs, pourtant il ten a bien 2..

En éspérant que quelqu'un sait maider



public class SAXHandler extends DefaultHandler {

	int nombreElements;
	int nombreAttributs;

	public SAXHandler() {
		nombreElements = 0;
		nombreAttributs = 0;
	}

	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
		if (qName != null) {
			nombreElements++;
		} else if (qName.equalsIgnoreCase("list")) {
			if (attributes.getValue("name") != null) {
				nombreAttributs++;
			}
		}

	}



Merci


Configuration: Windows / Chrome 72.0.3626.121

1 réponse

helloworld95
 
J'ai déplacé un bout de code est cela fonctionne :)
0