Commit c10d965e3efcb4075eed07eaa9bcb83760f15a67

Authored by Imanol-Mikel Barba Sabariego
1 parent a391f6b3

Mejorado HTMLParser para funcionar con nuevas versiones de Apache

gen/com/upc/pbe/upcnews/R.java
... ... @@ -15,40 +15,30 @@ public final class R {
15 15 public static final int ic_launcher=0x7f020001;
16 16 }
17 17 public static final class id {
18   - public static final int AbsoluteLayout1=0x7f080003;
19   - public static final int LinearLayout1=0x7f080000;
20   - public static final int button=0x7f080006;
21   - public static final int itemhelp=0x7f080009;
22   - public static final int itemprefs=0x7f080008;
23   - public static final int menu_settings=0x7f080007;
24   - public static final int textView1=0x7f080001;
25   - public static final int textView2=0x7f080002;
26   - public static final int textViewRoute=0x7f080005;
27   - public static final int textViewXml=0x7f080004;
  18 + public static final int AbsoluteLayout1=0x7f070000;
  19 + public static final int button=0x7f070003;
  20 + public static final int menu_settings=0x7f070004;
  21 + public static final int textViewRoute=0x7f070002;
  22 + public static final int textViewXml=0x7f070001;
28 23 }
29 24 public static final class layout {
30   - public static final int help=0x7f030000;
31   - public static final int main_activity=0x7f030001;
  25 + public static final int main_activity=0x7f030000;
32 26 }
33 27 public static final class menu {
34   - public static final int activity_main=0x7f070000;
35   - public static final int menu=0x7f070001;
  28 + public static final int activity_main=0x7f060000;
36 29 }
37 30 public static final class string {
38   - public static final int app_name=0x7f050000;
39   - public static final int descarregar=0x7f050003;
40   - public static final int help=0x7f050008;
41   - public static final int hint=0x7f050004;
42   - public static final int menu_settings=0x7f050001;
43   - public static final int prefs=0x7f050007;
44   - public static final int title_activity_main=0x7f050002;
45   - public static final int url=0x7f050005;
46   - public static final int urlhint=0x7f050006;
  31 + public static final int app_name=0x7f040000;
  32 + public static final int descarregar=0x7f040003;
  33 + public static final int help=0x7f040008;
  34 + public static final int hint=0x7f040004;
  35 + public static final int menu_settings=0x7f040001;
  36 + public static final int prefs=0x7f040007;
  37 + public static final int title_activity_main=0x7f040002;
  38 + public static final int url=0x7f040005;
  39 + public static final int urlhint=0x7f040006;
47 40 }
48 41 public static final class style {
49   - public static final int AppTheme=0x7f060000;
50   - }
51   - public static final class xml {
52   - public static final int prefs=0x7f040000;
  42 + public static final int AppTheme=0x7f050000;
53 43 }
54 44 }
... ...
src/com/upc/pbe/upcnews/HTMLParser.java
... ... @@ -15,14 +15,9 @@ public class HTMLParser {
15 15 public ArrayList<String> parse(){
16 16 //Separem el codi en linies
17 17 String[] split = code.split("\n");
18   - //Anem mirant cada linia. Si comença amb el tag <li> és un apartat de l'index i ens interessa. Els directoris en
19   - //HTML contenen una barra "/" seguida d'unes cometes, per tant, busquem la combinació en la linia. Si la conté,
20   - //la linia conté un directori. Tallem la linia on toca per treure'n el nom i l'afegim a la llista de directoris.
21 18 for(int i = 0; i < split.length; i++){
22   - if(split[i].startsWith("<li>")){
23   - if(split[i].contains("/\"")){
  19 + if(split[i].contains("href") && split[i].contains("/\"")){
24 20 directoris.add(split[i].substring(split[i].indexOf('>', 5), split[i].indexOf('<', 5)-1));
25   - }
26 21 }
27 22 }
28 23 return directoris;
... ...