Android Question Connecting to Online XML File

Discussion in 'Android Questions' started by philwest, May 16, 2015.

  1. philwest

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should use HttpUtils2 to download the file and parse it.
     
  3. warwound

    warwound Expert Licensed User

    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.
     
    thedesolatesoul likes this.
  4. philwest

    philwest Member Licensed User

    Thanks for the reply guys! Here is the link to the online xml file: http://n-able.info/actfeed.php
    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?

    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?
     

    Attached Files:

  5. Erel

    Erel Administrator Staff Member Licensed User

  6. philwest

    philwest Member Licensed User

    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.
     
  7. warwound

    warwound Expert Licensed User

    philwest likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice