Android Question Connecting to Online XML File

philwest

Member
Licensed User
Hello, I am trying to connect an app to read data from an xml file online but all the tutorials and posts I have come across only handle local xml files that are stored on their machine. Is it possible to connect an app to an xml file using a url?

Cheers, Phil
 

philwest

Member
Licensed User
Thanks for the reply guys! Here is the link to the online xml file: http://n-able.info/actfeed.php
You should use HttpUtils2 to download the file and parse it.
I tried altering the MySql Example to test out HttpUtils2 on whether I could connect to the xml database but ended up getting an error: An error has occured in sub: java.lang.RuntimeException: JSON Array expected. Continue?

Or use XOM.
The XOMBuilder object has a method BuildFromURL which will retrieve your remote XML file.
Once retrieved you can use XOM to parse it.
Thanks for providing an alternative method to handle this issue. The example you provided shows how the method BuildFromString is used, how do you use the method BuildFromURL?
 

Attachments

philwest

Member
Licensed User
Why? It has nothing to do with this.

First download the string: http://www.b4x.com/android/forum/threads/18992/#content

Then you need to parse it with SaxXml (or XOM).
My main goal is to connect to a database that is already being used for a website (as in creating an app for a website) but haven't had much luck connecting directly to that database. So we are trying another means of viewing the data within the database which is connect to an xml file generated by the website since we thought that might be an easier solution. Sorry for the confusion.

I will try playing around with that example now, cheers.
 
Top