From c10d965e3efcb4075eed07eaa9bcb83760f15a67 Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Wed, 21 Nov 2012 19:35:54 +0000 Subject: [PATCH] Mejorado HTMLParser para funcionar con nuevas versiones de Apache --- gen/com/upc/pbe/upcnews/R.java | 44 +++++++++++++++++--------------------------- src/com/upc/pbe/upcnews/HTMLParser.java | 7 +------ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/gen/com/upc/pbe/upcnews/R.java b/gen/com/upc/pbe/upcnews/R.java index f4452e7..f7f52ed 100644 --- a/gen/com/upc/pbe/upcnews/R.java +++ b/gen/com/upc/pbe/upcnews/R.java @@ -15,40 +15,30 @@ public final class R { public static final int ic_launcher=0x7f020001; } public static final class id { - public static final int AbsoluteLayout1=0x7f080003; - public static final int LinearLayout1=0x7f080000; - public static final int button=0x7f080006; - public static final int itemhelp=0x7f080009; - public static final int itemprefs=0x7f080008; - public static final int menu_settings=0x7f080007; - public static final int textView1=0x7f080001; - public static final int textView2=0x7f080002; - public static final int textViewRoute=0x7f080005; - public static final int textViewXml=0x7f080004; + public static final int AbsoluteLayout1=0x7f070000; + public static final int button=0x7f070003; + public static final int menu_settings=0x7f070004; + public static final int textViewRoute=0x7f070002; + public static final int textViewXml=0x7f070001; } public static final class layout { - public static final int help=0x7f030000; - public static final int main_activity=0x7f030001; + public static final int main_activity=0x7f030000; } public static final class menu { - public static final int activity_main=0x7f070000; - public static final int menu=0x7f070001; + public static final int activity_main=0x7f060000; } public static final class string { - public static final int app_name=0x7f050000; - public static final int descarregar=0x7f050003; - public static final int help=0x7f050008; - public static final int hint=0x7f050004; - public static final int menu_settings=0x7f050001; - public static final int prefs=0x7f050007; - public static final int title_activity_main=0x7f050002; - public static final int url=0x7f050005; - public static final int urlhint=0x7f050006; + public static final int app_name=0x7f040000; + public static final int descarregar=0x7f040003; + public static final int help=0x7f040008; + public static final int hint=0x7f040004; + public static final int menu_settings=0x7f040001; + public static final int prefs=0x7f040007; + public static final int title_activity_main=0x7f040002; + public static final int url=0x7f040005; + public static final int urlhint=0x7f040006; } public static final class style { - public static final int AppTheme=0x7f060000; - } - public static final class xml { - public static final int prefs=0x7f040000; + public static final int AppTheme=0x7f050000; } } diff --git a/src/com/upc/pbe/upcnews/HTMLParser.java b/src/com/upc/pbe/upcnews/HTMLParser.java index 04329ae..195d4a4 100644 --- a/src/com/upc/pbe/upcnews/HTMLParser.java +++ b/src/com/upc/pbe/upcnews/HTMLParser.java @@ -15,14 +15,9 @@ public class HTMLParser { public ArrayList parse(){ //Separem el codi en linies String[] split = code.split("\n"); - //Anem mirant cada linia. Si comença amb el tag
  • és un apartat de l'index i ens interessa. Els directoris en - //HTML contenen una barra "/" seguida d'unes cometes, per tant, busquem la combinació en la linia. Si la conté, - //la linia conté un directori. Tallem la linia on toca per treure'n el nom i l'afegim a la llista de directoris. for(int i = 0; i < split.length; i++){ - if(split[i].startsWith("
  • ")){ - if(split[i].contains("/\"")){ + if(split[i].contains("href") && split[i].contains("/\"")){ directoris.add(split[i].substring(split[i].indexOf('>', 5), split[i].indexOf('<', 5)-1)); - } } } return directoris; -- libgit2 0.22.2