500kb OPML parsing issues

by renegadea...@googlemail.com » Wed, 10 Jun 2009 10:37:08 GMT


Sponsored Links
 Right this is the problem. I am trying to find specific words within
this large OPML file which content is

: http://news.bbc.co.uk/rss/feeds.opml 

The file is a large list of rss feeds for various bbc news items - and
I need to parse it to find specific feeds.

Currently I am doing it as follows:

  http://pastebin.com/m15e0ea5f 

This is fairly fast if i search for say "celtic" however if you enter
"w00f" and run the command it will be disgustingly slow.

Can anybody demonstrate how I can parse this opml file using the
android xml parsers please - because i have tried, and tried, and
tried and cannot get it to do it!

Cheers

Andy
--~--~---------~--~----~------------~-------~--~----~



500kb OPML parsing issues

by Dave Bordoley » Wed, 10 Jun 2009 15:59:49 GMT


 Use a SAX parser to parse the XML, see
 http://developer.android.com/reference/javax/xml/parsers/SAXParser.html. 

Dave


On Tue, Jun 9, 2009 at 7:36 PM,



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


500kb OPML parsing issues

by Marc Lester Tan » Wed, 10 Jun 2009 16:11:58 GMT


 or use Pull Parser:

 http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html 


-Marc







--~--~---------~--~----~------------~-------~--~----~



500kb OPML parsing issues

by renegadea...@googlemail.com » Wed, 10 Jun 2009 19:32:04 GMT


 Can you actually show me some code doing it - I ave tried using these
and always fail with some exception... please demo how you would do
it!





--~--~---------~--~----~------------~-------~--~----~



500kb OPML parsing issues

by Sean Hodges » Wed, 10 Jun 2009 21:10:43 GMT


 Andy,

A simple example is provided on the already linked article for
PullParser 
( http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html )

An example for using the SAXParser is available here:
 http://www.anddev.org/parsing_xml_from_the_net_-_using_the_saxparser-t353.html 

If you get exceptions, please post them up (along with your source
code) so we can take a look at them and try to help out.


Regards,

Sean


On Wed, Jun 10, 2009 at 12:31 PM,






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Problem changing permission with chmod and runtime.getRuntime

Hi:

I'm trying to change file permissions with chmod from code using
runtime.getRuntime(). The problem is it runs ok in my smartphone
(Samsung GT-I5700) but in other devices (Motorola Cliq) it runs ok in
a few times and in other times it not change the permissions. Any
idea?  Thanks.

Here is my code:

                                    //Coypy program1 to app folder

                                     is = getAssets().open("program1");
                                         fos = new FileOutputStream(getDir("", 
MODE_WORLD_WRITEABLE)+"/
program1");
                                     tmp = new byte[1024];

                                    while ((l = is.read(tmp)) != -1) {
                                      fos.write(tmp, 0, l);
                                      fos.flush();
                                      }

                                    fos.close();
                                    is.close();

                                    //Coypy script.sh to app folder

                                    is = getAssets().open("script.sh");
                                         fos = new FileOutputStream(getDir("", 
MODE_WORLD_WRITEABLE)+"/
script.sh");
                                     tmp = new byte[1024];

                                    while ((l = is.read(tmp)) != -1) {
                                      fos.write(tmp, 0, l);
                                      fos.flush();
                                      }

                                    fos.close();
                                    is.close();

                                    //Set permissions rwxrwxrwx to program1
                                    commands = new String[] {"chmod","777", 
getDir("",
MODE_WORLD_WRITEABLE)+"/program1"};
                                    Process process = 
Runtime.getRuntime().exec("su");
                                    StringBuffer res = new StringBuffer();
                                    DataOutputStream os = new
DataOutputStream(process.getOutputStream());
                                    DataInputStream osRes = new 
DataInputStream(new
                                    
BufferedInputStream(process.getInputStream(),8192));
                                    for (String single : commands) {
                                         os.writeBytes(single + " ");
                                         os.flush();
                                         }
                                    os.writeBytes("exit\n");
                                    os.flush();
                                    os.close();
                                    process.waitFor();
                                    osRes.close();
                                    try { process.destroy();  } catch 
(Exception e) {   /* nothing
*/  }

                                         //Set permissions rwxrwxrwx to 
script.sh
                                         commands = new String[] 
{"chmod","777", getDir("",
MODE_WORLD_WRITEABLE)+"/script.sh"};
                                             process = 
Runtime.getRuntime().exec("su");
                                             res = new StringBuffer();
                                             os = new 
DataOutputStream(process.getOutputStream());
                                             osRes = new DataInputStream(new
                                            
BufferedInputStream(process.getInputStream(),8192));
                                          for (String single : commands) {
                                                 os.writeBytes(single + " ");
                                                 os.flush();
                                                 }
                                            os.writeBytes("exit\n");
                                            os.flush();
                                            os.close();
                                            process.waitFor();
                                            osRes.close();
                                                try { process.destroy();  } 
catch (Exception e) {   /* nothing
*/  }

-- 

2. S3C64XX RT2070L Android2.1 issue

Hi,Guys,I am debuging S3C64XX RT2070L Androdi2.1 issue,met some issue.any
friend can give some good suggestion?thanks!

D/SettingsWifiEnabler( 1964): Received wifi state changed from Disabled to
Enabling
D/WifiService( 1891): ACTION_BATTERY_CHANGED pluggedType: 1
E/WifiHW  ( 1891): Unable to open connection to supplicant on
"/data/system/wpa_supplicant/wlan0": No such file or directory
D/wpa_supplicant( 2072): Initializing interface 'wlan0' conf
'/data/misc/wifi/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A'
bridge 'N/A'
D/wpa_supplicant( 2072): Configuration file
'/data/misc/wifi/wpa_supplicant.conf' ->
'/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 2072): Reading configuration file
'/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 2072): update_config=1
D/wpa_supplicant( 2072): ctrl_interface='DIR=/data/system/wpa_supplicant
GROUP=wifi'
D/wpa_supplicant( 2072): eapol_version=1
D/wpa_supplicant( 2072): ap_scan=1
D/wpa_supplicant( 2072): fast_reauth=1
D/wpa_supplicant( 2072): Initializing interface (2) 'wlan0'
D/wpa_supplicant( 2072): EAPOL: SUPP_PAE entering state DISCONNECTED
D/wpa_supplicant( 2072): EAPOL: KEY_RX entering state NO_KEY_RECEIVE
D/wpa_supplicant( 2072): EAPOL: SUPP_BE entering state INITIALIZE
D/wpa_supplicant( 2072): EAP: EAP entering state DISABLED
D/wpa_supplicant( 2072): EAPOL: External notification - portEnabled=0
D/wpa_supplicant( 2072): EAPOL: External notification - portValid=0
D/SettingsWifiEnabler( 1964): Received wifi state changed from Enabling to
Enabled
[   53.685117] <-- RTMPAllocTxRxRingMemory, Status=0
[   53.707149] -->RTUSBVenderReset
[   53.709149] <--RTUSBVenderReset
E/WifiHW  ( 1891): Unable to open connection to supplicant on
"/data/system/wpa_supplicant/wlan0": No such file or directory
[   58.551652] Key1Str is Invalid key length(0) or Type(0)
[   58.551808] Key2Str is Invalid key length(0) or Type(0)
[   58.556617] Key3Str is Invalid key length(0) or Type(0)
[   58.561821] Key4Str is Invalid key length(0) or Type(0)
[   58.568985] 1. Phy Mode = 9
[   58.569623] 2. Phy Mode = 9
[   58.572449] NVM is Efuse and its size =2d[2d0-2fc]
[   59.779384] 3. Phy Mode = 9
[   59.874377] RTMPSetPhyMode: channel is out of range, use first channel=1
[   59.926393] MCS Set = ff 00 00 00 01
E/WifiHW  ( 1891): Unable to open connection to supplicant on
"/data/system/wpa_supplicant/wlan0": No such file or directory
D/WifiService( 1891): ACTION_BATTERY_CHANGED pluggedType: 1
[   62.710501] RTMPFilterCalibration - can't find a valid value, loopcnt=102
stop calibrating<==== rt28xx_init, Status=0
[   63.057503] 0x1300 = 00064300
D/wpa_supplicant( 2072): SIOCGIWRANGE: WE(compiled)=22 WE(source)=14
enc_capa=0xf
D/wpa_supplicant( 2072):   capabilities: key_mgmt 0xf enc 0xf
D/wpa_supplicant( 2072): WEXT: Operstate: linkmode=1, operstate=5
D/wpa_supplicant( 2072): Own MAC address: 00:19:94:12:0b:61
D/wpa_supplicant( 2072): wpa_driver_wext_set_wpa
D/wpa_supplicant( 2072): wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0
seq_len=0 key_len=0
D/wpa_supplicant( 2072): wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0
seq_len=0 key_len=0
D/wpa_supplicant( 2072): wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0
seq_len=0 key_len=0
D/wpa_supplicant( 2072): wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0
seq_len=0 key_len=0
D/wpa_supplicant( 2072): wpa_driver_wext_set_countermeasures
D/wpa_supplicant( 2072): wpa_driver_wext_set_drop_unencrypted
D/wpa_supplicant( 2072): Setting scan request: 0 sec 100000 usec
D/wpa_supplicant( 2072): Using existing control interface directory.
D/wpa_supplicant( 2072): ctrl_interface_group=1010 (from group name 'wifi')
D/wpa_supplicant( 2072): Added interface wlan0
D/wpa_supplicant( 2072): RTM_NEWLINK: operstate=0 ifi_flags=0x11043
([UP][RUNNING][LOWER_UP])
D/wpa_supplicant( 2072): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
D/wpa_supplicant( 2072): RTM_NEWLINK: operstate=0 ifi_flags=0x11043
([UP][RUNNING][LOWER_UP])
D/wpa_supplicant( 2072): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
D/wpa_supplicant( 2072): Wireless event: cmd=0x8b06 len=8
D/wpa_supplicant( 2072): RTM_NEWLINK: operstate=0 ifi_flags=0x11003
([UP][LOWER_UP])
D/wpa_supplicant( 2072): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
D/wpa_supplicant( 2072): State: DISCONNECTED -> SCANNING
I/wpa_supplicant( 2072): CTRL-EVENT-STATE-CHANGE id=-1 state=2
D/wpa_supplicant( 2072): Starting AP scan (broadcast SSID)
D/wpa_supplicant( 2072): Trying to get current scan results first without
requesting a new scan to speed up initial association
D/wpa_supplicant( 2072): Received 0 bytes of scan results (0 BSSes)
D/wpa_supplicant( 2072): Scan results: 0
I/wpa_supplicant( 2072): CTRL-EVENT-SCAN-RESULTS  Ready
D/wpa_supplicant( 2072): No suitable AP found.
D/wpa_supplicant( 2072): Setting scan request: 0 sec 0 usec
D/wpa_supplicant( 2072): Starting AP scan (broadcast SSID)
D/wpa_supplicant( 2072): Scan requested (ret=0) - scan timeout 5 seconds
[   64.376360] --- Power Button release, code=116



I use iwlist scanning to test in console,it can detect AP network,but
android say that issue"/data/system/wpa_supplicant/wlan0"

i use wpa_supplicant -Dwext -d -iwlan0 -c
./data/misc/wifi/wpa_supplicant.conf ,it have wlan0 in
/data/system/wpa_supplicant/ directory,so i guess it should be permission
issue,but i have give permission in init.rc.

attachment is init.rc,hardware_leagcy/wifi,wpa_supplicant.conf,dhcpcd.conf


this question is so wird.


B.R
Tommy


-- 
our psychological growth is the movement from dependence to independence  to
interdependence!

-- 

3. Checking if phone is ROOTED

4. [WTHelp] Jaringan 3 -Three- di daerah Bekasi

5. Formats and browser

6. TextView length limit? How strange!

7. Desire S vs Incredible S