2011-05-20 121 views
0
public class XMLParsingExample extends ListActivity { 
String name = null; 
private String array_estado[]; 
private String[] array_ciudad; 
private String array_barrio[]; 
/** Create Object For SiteList Class */ 
SitesList sitesList = null; 
/** Called when the activity is first created. */ 
@SuppressWarnings("unchecked") 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.listplaceholder); 
    /** Create a new layout to display the view */ 
    LinearLayout layout = new LinearLayout(this); 
    layout.setOrientation(1); 
try { 

     SAXParserFactory spf = SAXParserFactory.newInstance(); 
     SAXParser sp = spf.newSAXParser(); 
     XMLReader xr = sp.getXMLReader(); 

     /** Send URL to parse XML Tags */ 
     URL sourceUrl = new URL(
       "http://www.arteonline.mobi/iphone/output.php?key=Buenos"); 

     MyXMLHandler myXMLHandler = new MyXMLHandler(); 
     xr.setContentHandler(myXMLHandler); 
     xr.parse(new InputSource(sourceUrl.openStream())); 

    } 
     catch (Exception e) 
     { 
     System.out.println("XML Pasin"); 
     } 
} 
} 
+0

問題是什麼? – 2011-05-20 08:25:14

回答

0

我認爲,如果想在ListView控件

顯示您的分析數據,從數據解析做一個ArrayList和 從做一個適配器,然後將其設置爲你的ListView