I have searched for two days now, I probably have seen a solution that would solve my problem, though I have yet to find one I understand.
I am following this tutorial - Simple XMLPullParser Tutorial
The two areas I know I need to change are
Here 1
public List<Employee> parse(InputStream is) {
XmlPullParserFactory factory = null;
XmlPullParser parser = null;
try {
factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
parser = factory.newPullParser();
parser.setInput(is, null);
int eventType = parser.getEventType();
and Here 2
List<Employee> employees = null;
try {
XMLPullParserHandler parser = new XMLPullParserHandler();
employees = parser.parse(getAssets().open("employees.xml"));
This is from the working example, below is taken from what I am trying to achieve, removing this
employees = parser.parse(getAssets().open("employees.xml"));
I tried to get something like
URL url=new URL("http://www.example.xml");
URLConnection connection = url.openConnection();
InputStream in = connection.getInputStream();
employees = parser.parse(in);
The first piece I am not so sure what to change, the second I know I need to add the url, and open a connection. Then change the employees = parser... line, but to this point have no luck in getting a working response.
I have added android.permission.INTERNET.
I have also added my own XML file in the assets folder, a copy of the url I want to parse, which works fine.
Any help would be greatly appreciated.