Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

parse xml

Featured Replies

Posté(e)

Bonjour.

j'ai un fichier xml que je récupère sur un serveur et qu'ensuite je voudrais exploiter.

J'ai trouvé ce tuto mais je bloque

http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/

J'arrive bien a récupérer mon fichier, j'arrive a le transformer en Document

mais ensuite je ne comprend ceux qu'il se passe

j'ai donc mon fichier xml en Document mais après je ne sais pas quoi en faire

Pourriez vous m'aider.

Merci

Modifié par anthebest

Posté(e)

Je ne vois pas où est le problème. La récupération des infos est assez explicite dans la section USAGE (enfin, pour moi c'est clair) :/

Posté(e)
  • Auteur

dans

public String getValue(Element item, String str) {
 NodeList n = item.getElementsByTagName(str);
 return this.getElementValue(n.item(0));
}

quand j'utilise la méthode je ne sais pas quoi mettre dans Element item

Dans l'exemple il met e mais je ne sais pas ceux que c'est

Posté(e)

Il y a semble-t'il un oubli dans le tuto, effectivement

Dans l'exemple d'utilisation, il faudrait qu'il récupère l'élément courant de la liste des éléments par un

Element e = (Element) nl.item(i);

dans


// looping through all item nodes <item>
for (int i = 0; i < nl.getLength(); i++) {
   Element e = (Element) nl.item(i);
String name = parser.getValue(e, KEY_NAME); // name child value
  ...

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.