Parser sax

Résolu/Fermé
helloworld95 - 16 mars 2019 à 14:54
 helloworld95 - 16 mars 2019 à 14:56
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
16 mars 2019 à 14:56
J'ai déplacé un bout de code est cela fonctionne :)
0