package com.upc.pbe.upcnews; import java.util.ArrayList; import android.util.Log; public class HTMLParser { private final static String TAG = "HTMLParser"; private ArrayList resources; private String server; public HTMLParser(String u) { String host = u.substring(7); server = u.substring(0,host.indexOf("/")+7); resources = new ArrayList(); } public ArrayList parse(String code) { if(!resources.isEmpty()) { resources.clear(); } parseDirectories(resources,code); parseFiles(resources,code); return resources; } public void parseDirectories(ArrayList resources, String code) { // Separem el codi en linies String[] split = code.split("\n"); /* * Busquemos el tag , descartando comentarios: */ for (int i = 0; i < split.length; i++) { while (split[i].startsWith("")) { break; } } // Posible comentario descartado if (split[i].indexOf(" resources, String code) { String[] split = code.split("\n"); for (int i = 0; i < split.length; i++) { while (split[i].startsWith("")) { break; } } // Posible comentario descartado if (split[i].contains("