bekomme xml nicht ausgelesen

ballibum

Aktives Mitglied
Hallo Forum,
ich bekomme einfach meine XML Datei nicht ausgelesen. Der Input scheint zu Funktionieren, denn die NodeList hat die entsprechende Länge/Größe. Wenn ich dann aber ans eingemachte möchte bekomme ich nur "null" als Resultat.
Hier einmal mein Code



Java:
package vogella.uebung;

import java.net.URL;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class VogellaActivity extends Activity {
	
	private TextView xmlField;
	private String provider;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		xmlField = (TextView) findViewById(R.id.TextView06);
		xmlField.setText("XML");
		buttonklick();
		
		
	}

	private void buttonklick() {
		Button buttonXML = (Button) findViewById(R.id.koordinaten_button); 
    	        buttonXML.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
					try
					{
						URL url = new URL("http://www.hemitheconyx-caudicinctus.de/testxml.xml");
						DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
						DocumentBuilder db = dbf.newDocumentBuilder();
						Document doc = db.parse(new InputSource(url.openStream()));
						doc.getDocumentElement().normalize();
						NodeList nodeList = doc.getElementsByTagName("artist");
						String huhu1 =  nodeList.item(0).getNamespaceURI()+"";
						Log.v(huhu1,"index");
						String huhu2 =  nodeList.item(0).getNodeValue()+"";
						Log.v(huhu2,"index");
						String huhu3 =  nodeList.item(0).getLocalName()+"";
						Log.v(huhu3,"index");
						String huhu4 =  nodeList.item(0).getAttributes()+"";
						Log.v(huhu4,"index");
						xmlField.setText("§");
					}
					catch(Exception e){
						
						xmlField.setText("XML nicht eingelesen");
					}
					
					
					
				}	
	});
	}

	
}

Leider habe ich keine Ahnung woran es liegen könnte...bin für jede Art der Hilfe Dankbar.
mfg
Balli
 
tztz, gefühlt keine Minute vergangen und ich habe eine Antwort aus dem Lehrbuch. Ich danke dir.....AUf das Hansa wenigstens nicht absteigt!
 

Zurück
Oben