Parsing XML from the Net - Using the SAXParser

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Postby plusminus » Sat Mar 08, 2008 5:40 pm

Hello Anthony,

is pretty long ago... so your xml looks like this (simplified):
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <!-- 21 times the same structure... -->
  2. <frbny:Key>
  3.      <frbny:CURR>AUD</frbny:CURR>
  4. </frbny:Key>
  5. <frbny:Obs OBS_STATUS="A" OBS_CONF="F">
  6.      <frbny:OBS_VALUE>0.9069</frbny:OBS_VALUE>
  7. </frbny:Obs>
  8. <!-- ... "loop" -->
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


right :?:

So i would do it like this:
  1. When entering [font=Lucida Console]<frbny:CURR>[/font] add one new element to the output-list
  2. When in [font=Lucida Console]characters()[/font] and [font=Lucida Console]this.in_curr_tag == true[/font], get the last element from the list (which is the one just added) and set its String.
  3. When entering [font=Lucida Console]<frbny:OBS_VALUE>[/font], do nothing, as the most recent element in the list is waiting to get the Double filled.
  4. When in [font=Lucida Console]characters()[/font] and [font=Lucida Console]this.in_curr_tag == true[/font], fill the Double of the last added Peds in the list.

So, without any testing:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import java.util.ArrayList;
  2.  
  3. import org.xml.sax.Attributes;
  4. import org.xml.sax.SAXException;
  5. import org.xml.sax.helpers.DefaultHandler;
  6.  
  7. public class ExampleHandler extends DefaultHandler {
  8.    
  9.      // only the relevant tags
  10.      
  11.      private boolean in_curr_tag = false;
  12.      private boolean in_obs_tag = false;
  13.      
  14.      private ArrayList<ParsedExampleDataSet> list = new ArrayList<ParsedExampleDataSet>(22); // 22 == capacity
  15.        
  16.      public ArrayList<ParsedExampleDataSet> getParsedData(){
  17.           return this.list;
  18.      }
  19.      
  20.      @Override
  21.      public void startDocument() throws SAXException {
  22.           //nothing to do here
  23.      }
  24.      
  25.      @Override
  26.      public void endDocument() throws SAXException {
  27.           //nothing to do here
  28.      }
  29.      
  30.      /*
  31.       * Gets be called on opening tags like
  32.       * <tag>
  33.       * Can provide attribute(s), when xml was like:
  34.       * <tag attribute="attributeValue">*/
  35.       @Override
  36.       public void startElement(String namespaceURI, String localName,
  37.                                         String qName, Attributes atts)throws SAXException{
  38.          
  39.            if(localName.equals("frbny:CURR")){
  40.                 list.add(new ParsedExampelDataSet());
  41.                 this.in_curr_tag = true;
  42.            }else if(localName.equals("frbny:OBS_VALUE")){
  43.                 this.in_obs_tag = true;
  44.            }
  45.       }
  46.      
  47.       //Called on closing tags like </tag>
  48.       @Override
  49.       public void endElement(String namespaceURI, String localName, String qName) throws SAXException{
  50.            if(localName.equals("frbny:CURR")){
  51.                 this.in_curr_tag = false;
  52.            }else if(localName.equals("frbny:OBS_VALUE")){
  53.                 this.in_obs_tag = false;
  54.            }
  55.       }
  56.      
  57.       /** Gets be called on the following structure:
  58.       * <tag>characters</tag> */
  59.      @Override
  60.     public void characters(char ch[], int start, int length) {
  61.      // getLast()-Function is probably not existing, need to do on your own
  62.       if(this.in_curr_tag){  
  63.            list.getLast().setExtractedString(new String(ch, start, length));
  64.       }
  65.       if(this.in_obs_tag){
  66.             list.getLast().setExtractedDouble(Double.parseDouble(new String(ch, start, length)));
  67.       }
  68.     }
  69. }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

creating the getlast method

Postby Ant1 » Thu Mar 13, 2008 12:11 am

Thanks for the response PlusMinus all the help so far is appreciated, one question I have is how would I add that method getLast() to the ArrayList Class can I import the whole class into my project and add it there or do I just create a method in my class I can't seem to find how to do it in eclipse.

again thanks for the help

Anthony
Ant1
Freshman
Freshman
 
Posts: 4
Joined: Sun Feb 17, 2008 11:56 pm

Postby umniaxa1 » Sun Mar 23, 2008 1:25 pm

Please, help. I have the following code. From my point of view it has to work. But it doesn't work. Will you be so kind do show me my mistake?

Main Aplication

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.xml_metro;
  2.  
  3. import android.app.Activity;
  4. import android.content.Resources;
  5. import android.os.Bundle;
  6. import android.widget.TextView;
  7.  
  8. import javax.xml.parsers.*;
  9.  
  10. import java.io.*;
  11. import java.util.ResourceBundle;
  12.  
  13. import org.xml.sax.*;
  14. import org.xmlpull.v1.XmlPullParser;
  15.  
  16. import java.net.MalformedURLException;
  17. import java.net.URL;
  18.  
  19.  
  20.  
  21.  
  22. public class xml_metro extends Activity {
  23.  
  24.     @Override
  25.     public void onCreate(Bundle icicle) {
  26.         super.onCreate(icicle);    
  27.        
  28.        
  29.         TextView tv = new TextView(this);
  30.         try {
  31.                
  32.                         //SampleView view = new SampleView(this);                              
  33.                        
  34.                         SAXParserFactory spf = SAXParserFactory.newInstance();
  35.                         SAXParser sp = spf.newSAXParser();
  36.  
  37.            
  38.                         XMLReader xr = sp.getXMLReader();
  39.                         MapHandler map = new MapHandler ();
  40.                                 xr.setContentHandler(map);
  41.                                 File f = new File ("c:\data.xml");
  42.                                 InputStream str =  f.toURL().openStream();
  43.                                 xr.parse(new InputSource(str));                        
  44.                                 ParsedExampleDataSet parsedExampleDataSet =
  45.                                         map.getParsedData();
  46.  
  47.                                        
  48.                                
  49.                                 tv.setText(parsedExampleDataSet.getExtractedString()+parsedExampleDataSet.getExtractedInt());
  50.                        
  51.                                
  52.                         } catch (SAXParseException e) {
  53.                                 e.printStackTrace();
  54.                         } catch (ParserConfigurationException e) {
  55.                                 e.printStackTrace();
  56.                         } catch (SAXException e) {
  57.                                 e.printStackTrace();
  58.                         } catch (MalformedURLException e) {
  59.                                 e.printStackTrace();
  60.                         } catch (IOException e) {
  61.                                 e.printStackTrace();
  62.                         }
  63.            
  64.                         //tv.setText("12424242445");
  65.                 this.setContentView(tv);               
  66.                        
  67.     }
  68. }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


Handler

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.xml_metro;
  2.  
  3.  
  4. import org.xml.sax.helpers.DefaultHandler;
  5. import org.xml.sax.*;
  6.  
  7. class MapHandler extends DefaultHandler {
  8.        
  9.        
  10.  
  11.         private ParsedExampleDataSet myParsedExampleDataSet = new ParsedExampleDataSet();
  12.  
  13.        
  14.         public ParsedExampleDataSet getParsedData() {
  15.                  return this.myParsedExampleDataSet;
  16.     }
  17.          
  18.    
  19.         @Override
  20.         public void startElement(String uri, String name,
  21.                                                                         String qname, Attributes attrs) throws SAXException{
  22.                
  23.                 if (qname.equals("Station")){
  24.                         this.myParsedExampleDataSet.setExtractedString(attrs.getValue("name"));
  25.                 } else {
  26.                         this.myParsedExampleDataSet.setExtractedInt(1);
  27.                 }
  28.                
  29.         }      
  30.  
  31. }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


DataSet

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.xml_metro;
  2.  
  3. public class ParsedExampleDataSet {
  4.      private String extractedString = "dfgghdgf";
  5.      private int extractedInt =   123;
  6.  
  7.      public String getExtractedString() {
  8.           return extractedString;
  9.      }
  10.      public void setExtractedString(String extractedString) {
  11.           this.extractedString = extractedString;
  12.      }
  13.  
  14.      public int getExtractedInt() {
  15.           return extractedInt;
  16.      }
  17.      public void setExtractedInt(int extractedInt) {
  18.           this.extractedInt = extractedInt;
  19.      }
  20.      
  21.    
  22. }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


XML

<?xml version="1.0"?>

<map name="Бобруйский Метроролитен" number="3">
<Station id="1" name="ДубочОк" line="ДэрЭвяшечка" color="brown" x="20" y="20" next="0" privious="0" hub="0"></Station>
<number>3</number></map>


Thanks for any help in advance
umniaxa1
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Mar 23, 2008 1:14 pm

Postby lortest » Wed Oct 01, 2008 1:06 pm

i use the code that plusminus give to read the xml files and when i lauch the application, iut load android phone and i have the message

Error : unknown error

can someone help me ?
lortest
Freshman
Freshman
 
Posts: 3
Joined: Wed Sep 03, 2008 1:04 pm

Postby Artur79 » Wed Oct 01, 2008 2:08 pm

I have the same :( . I assume that its something wrong with network connection

Code: Select all
10-01 13:07:00.072: ERROR/OSNetworkSystem(2834): unknown socket error -1
10-01 13:07:00.093: ERROR/WeatherForcaster(2834): WeatherQueryError
10-01 13:07:00.093: ERROR/WeatherForcaster(2834): java.net.SocketException: unknown error
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl(Native Method)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.platform.OSNetworkSystem.createSocket(OSNetworkSystem.java:79)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.net.PlainSocketImpl2.create(PlainSocketImpl2.java:59)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at java.net.Socket.checkClosedAndCreate(Socket.java:763)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at java.net.Socket.connect(Socket.java:910)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:61)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:800)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:786)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1030)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at java.net.URL.openStream(URL.java:664)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at org.anddev.android.parsingxml.ParsingXML.onCreate(ParsingXML.java:44)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2103)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2156)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.os.Handler.dispatchMessage(Handler.java:88)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.os.Looper.loop(Looper.java:123)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at android.app.ActivityThread.main(ActivityThread.java:3742)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at java.lang.reflect.Method.invokeNative(Native Method)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at java.lang.reflect.Method.invoke(Method.java:515)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
10-01 13:07:00.093: ERROR/WeatherForcaster(2834):     at dalvik.system.NativeStart.main(Native Method)
10-01 13:07:00.212: INFO/ActivityManager(46): Displayed activity org.anddev.android.parsingxml/.ParsingXML: 720 ms
10-01 13:07:05.272: DEBUG/dalvikvm(1661): GC freed 44 objects / 1832 bytes in 44ms
Artur79
Developer
Developer
 
Posts: 26
Joined: Fri Sep 26, 2008 12:53 pm

Postby ninor » Wed Oct 01, 2008 4:32 pm

Maybe some uses-permission is missing?
Check the available permission list in Android Docs to see if one fits.
User avatar
ninor
Moderator
Moderator
 
Posts: 180
Joined: Thu Aug 14, 2008 6:30 pm
Location: Barcelona, Spain

Top

Postby richard.puckett » Fri Oct 03, 2008 4:01 am

Try adding the following to your AndroidManifest.xml directly under the "manifest" node:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.INTERNET"></uses-permission>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
richard.puckett
Junior Developer
Junior Developer
 
Posts: 13
Joined: Thu Dec 27, 2007 2:37 am
Location: Seattle, WA

Postby Artur79 » Fri Oct 03, 2008 12:01 pm

richard.puckett wrote:Try adding the following to your AndroidManifest.xml directly under the "manifest" node:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.INTERNET"></uses-permission>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

thanks, thats much better :)
But still there is a small problem, it doesnt return first string, so the output is

ExtractedString =
ExtractedInt = 1337


I've pushed to log an info message every time characters() method is runned, it shows length param also

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void characters(char ch[], int start, int length) {
  2.        if(this.in_mytag){
  3.  
  4.            String s = new String(ch, start, length);
  5.            Log.i(ParsingXML.MY_DEBUG_TAG, "in_mytag length=" + length);
  6.            myParsedExampleDataSet.setExtractedString(s);
  7.        }
  8.     }
  9.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


the output is:
10-03 10:55:51.605: INFO/WeatherForcaster(920): in_mytag length=1
10-03 10:55:51.605: INFO/WeatherForcaster(920): in_mytag length=22
10-03 10:55:51.605: INFO/WeatherForcaster(920): in_mytag length=1
10-03 10:55:51.613: INFO/WeatherForcaster(920): in_mytag length=2

I thought it'll be runned only if we are in in_mytag but looks its triggered for each tag
Artur79
Developer
Developer
 
Posts: 26
Joined: Fri Sep 26, 2008 12:53 pm

Postby Denvar » Mon Oct 13, 2008 10:05 pm

Hi I was wandering if someone here could help me out a lil.

I have an xml in the following format

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <tepa>
  2.     <ding>One</ding>
  3.     <title>Overlay</title>
  4. <tepa>
  5. <item>
  6.     <title>Horp</title>
  7.     <day>Thu</day>
  8.     <time>12:45</time>
  9.     <cat>fon</cat>
  10. </item>
  11. <item>
  12.     <title>Rink</title>
  13.     <day>Thu</day>
  14.     <time>10:22</time>
  15.     <cat>shan</cat>
  16. </item>
  17.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


The xml file is located at http://www.somesite/one.xml and I want to extract the content of the <title> and <cat> tags inside the various <item> objects in the file.

After reading in these values I wish to output the results in my 'args.txt' file like so


Code: Select all
title - cat
title - cat
title - cat


Any ideas? Thanks in advance :)
Denvar
Freshman
Freshman
 
Posts: 4
Joined: Mon Oct 13, 2008 9:56 pm

Postby legerb » Thu Oct 16, 2008 9:54 am

I'm trying to parse xml fro my raw resources, but I'm getting "java.io.IOException: Couldn't open res/raw/demo_config.xml"
at the parse line.
here is the code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void onReceive(Context context, Intent intent)
  2.  
  3.         {
  4.  
  5.                 SAXParserFactory spf = SAXParserFactory.newInstance();
  6.  
  7.                 try
  8.  
  9.                 {
  10.  
  11.                         SAXParser sp = spf.newSAXParser();
  12.  
  13.                         XMLReader xr = sp.getXMLReader();
  14.  
  15.                         XMLHandler xmlHandler = new XMLHandler();
  16.  
  17.                         xr.setContentHandler(xmlHandler);
  18.  
  19.                         xr.parse(new InputSource(context.getResources().getString(R.raw.demo_config)));
  20.  
  21.                 }
  22.  
  23.                 catch (Exception e)
  24.  
  25.                 {
  26.  
  27.                        
  28.  
  29.                 }
  30.  
  31.  
  32.  
  33.         }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4

When I try to open xml from the net, it works. Why shouldn't it work with a resources file?
legerb
Freshman
Freshman
 
Posts: 4
Joined: Thu Sep 25, 2008 10:48 am

Postby legerb » Thu Oct 16, 2008 5:33 pm

mmm... weird... it worked out with:
xr.parse(new InputSource(context.getResources().openRawResource(R.raw.demo_config)));
legerb
Freshman
Freshman
 
Posts: 4
Joined: Thu Sep 25, 2008 10:48 am

URGENT HELP NEEDED

Postby vikrant » Fri Oct 17, 2008 11:45 am

hi plusminus
I tried your SAX xml parser example and the code compiled correctly and when i launched the Emulator window for the result to see, It just says
Unknow Error:

and a blank screen is there

Any ideas whats the problem..
My all apps are working fine only the apps trying to access the network connections are facing this issue. Do we need to make some settings or something

plz help
thnx
User avatar
vikrant
Freshman
Freshman
 
Posts: 6
Joined: Tue Oct 14, 2008 7:26 am
Location: CA,USA

Postby Artur79 » Fri Oct 17, 2008 4:51 pm

vikrant, have you added this to your manifest file ?

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.INTERNET"></uses-permission>
  2.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
Artur79
Developer
Developer
 
Posts: 26
Joined: Fri Sep 26, 2008 12:53 pm

Postby JavaAndroid » Sat Oct 18, 2008 4:36 pm

Hi All,
I added that android <uses-permission>tag in my Androidmanifest.xml

but after that i m getting this UnknownHostException

10-18 20:59:25.355: ERROR/dalvikvm(166): pthread_setspecific failed, err=22
10-18 20:59:29.055: ERROR/ParsingXML(178): ParsingXMLError
10-18 20:59:29.055: ERROR/ParsingXML(178): java.net.UnknownHostException: Host is unresolved: http://www.anddev.org:80
10-18 20:59:29.055: ERROR/ParsingXML(178): at java.net.Socket.connect(Socket.java:928)
10-18 20:59:29.055: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:61)
10-18 20:59:29.055: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
10-18 20:59:29.055: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
10-18 20:59:29.055: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:800)
10-18 20:59:29.055: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:786)
10-18 20:59:29.055: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1030)
10-18 20:59:29.055: ERROR/ParsingXML(178): at java.net.URL.openStream(URL.java:664)
10-18 20:59:29.055: ERROR/ParsingXML(178): at com.dreamapp.parsingxml.activity.ParsingXML.onCreate(ParsingXML.java:34)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2103)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2156)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.os.Handler.dispatchMessage(Handler.java:88)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.os.Looper.loop(Looper.java:123)
10-18 20:59:29.055: ERROR/ParsingXML(178): at android.app.ActivityThread.main(ActivityThread.java:3742)
10-18 20:59:29.055: ERROR/ParsingXML(178): at java.lang.reflect.Method.invokeNative(Native Method)
10-18 20:59:29.055: ERROR/ParsingXML(178): at java.lang.reflect.Method.invoke(Method.java:515)
10-18 20:59:29.055: ERROR/ParsingXML(178): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
10-18 20:59:29.055: ERROR/ParsingXML(178): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
10-18 20:59:29.055: ERROR/ParsingXML(178): at dalvik.system.NativeStart.main(Native Method)
10-18 20:59:29.906: ERROR/ParsingXML(178): ParsingXMLError
10-18 20:59:29.906: ERROR/ParsingXML(178): java.net.UnknownHostException: Host is unresolved: http://www.anddev.org:80
10-18 20:59:29.906: ERROR/ParsingXML(178): at java.net.Socket.connect(Socket.java:928)
10-18 20:59:29.906: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:61)
10-18 20:59:29.906: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
10-18 20:59:29.906: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
10-18 20:59:29.906: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:800)
10-18 20:59:29.906: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:786)
10-18 20:59:29.906: ERROR/ParsingXML(178): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1030)
10-18 20:59:29.906: ERROR/ParsingXML(178): at java.net.URL.openStream(URL.java:664)
10-18 20:59:29.906: ERROR/ParsingXML(178): at com.dreamapp.parsingxml.activity.ParsingXML.onCreate(ParsingXML.java:34)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2103)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2156)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3086)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.ActivityThread.access$1900(ActivityThread.java:112)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.os.Handler.dispatchMessage(Handler.java:88)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.os.Looper.loop(Looper.java:123)
10-18 20:59:29.906: ERROR/ParsingXML(178): at android.app.ActivityThread.main(ActivityThread.java:3742)
10-18 20:59:29.906: ERROR/ParsingXML(178): at java.lang.reflect.Method.invokeNative(Native Method)
10-18 20:59:29.906: ERROR/ParsingXML(178): at java.lang.reflect.Method.invoke(Method.java:515)
10-18 20:59:29.906: ERROR/ParsingXML(178): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
10-18 20:59:29.906: ERROR/ParsingXML(178): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
10-18 20:59:29.906: ERROR/ParsingXML(178): at dalvik.system.NativeStart.main(Native Method)
10-18 20:59:30.426: ERROR/NetworkStateTracker(52): Can't set tcp buffer sizes:java.io.FileNotFoundException: /sys/kernel/ipv4/tcp_rmem_min


Can anyone figure out the reason for this error?

Thanks in Advacne

JavaAndroid
JavaAndroid
Freshman
Freshman
 
Posts: 7
Joined: Wed Oct 15, 2008 8:02 am

Postby bstubbs » Wed Oct 22, 2008 8:03 pm

Artur79, did you ever figure out how to solve the missing string?

I'm getting the same results:


ExtractedString =
ExtractedInt = 1337


Anyone else getting this, found a solution? Thanks
bstubbs
Freshman
Freshman
 
Posts: 3
Joined: Wed Oct 08, 2008 7:23 pm

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests