private UrlList parseUrl(URL url) {
URL SourceUrl = null;
SourceUrl = url;
try {
/** Handling XML */
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
/** Create handler to handle XML Tags (extends DefaultHandler) */
XMLParser myXmlParser = new XMLParser();
xr.setContentHandler(myXmlParser);
xr.parse(new InputSource(SourceUrl.openStream()));
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
System.out.println(" XMLParsing error is : " + e);
}
urlList = XMLParser.urlList;
return urlList;
}// end of parseurl
URL中的IAM給予是
sourceUrl =新的URL(「文件:// C:/Users/raghu/Desktop/aero/products.xml 「); 同樣,我有足夠的資源路徑也以同樣的方式
file://C:/Users/raghu/Desktop/aero/"resource sub folders"
我收到以下錯誤
D/dalvikvm( 118): GC_EXPLICIT freed 80K, 52% free 2864K/5895K, external 2155K/2537K, paused 82ms
W/System.err(1078): java.io.IOException: Unable to connect to server: null
W/System.err(1078): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:203)
W/System.err(1078): at org.apache.harmony.luni.internal.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:300)
W/System.err(1078): at java.net.URL.openStream(URL.java:645)
W/System.err(1078): at com.omkarsoft.ImagePortofolio.ImagePortofolio.parseUrl(ImagePortofolio.java:178)
W/System.err(1078): at com.omkarsoft.ImagePortofolio.ImagePortofolio.onCreate(ImagePortofolio.java:76)
W/System.err(1078): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
W/System.err(1078): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
W/System.err(1078): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
W/System.err(1078): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
W/System.err(1078): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
W/System.err(1078): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(1078): at android.os.Looper.loop(Looper.java:123)
W/System.err(1078): at android.app.ActivityThread.main(ActivityThread.java:3683)
W/System.err(1078): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(1078): at java.lang.reflect.Method.invoke(Method.java:507)
W/System.err(1078): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
W/System.err(1078): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
嘗試在資產中的此xml存儲並嘗試解析&您給路徑「C:/ ...」的一件事可能不正確 – 2011-03-29 07:07:03