Android app question

Jan 23, 2006
167
0
76
Hello,
I am currently working on a project where the app will need to be able to pull stuff off of a specific website.

Does anybody know of a good website that can be used to teach how to do that and has some demo pages for accessing stuff?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Any simple website could be used for that. Just read the markup into a buffer using whatever web request class Java supports, then load the markup into a DOM (again, not a java programmer, so whatever they call it) and use xpath or collection traversal to walk the objects in the DOM until you find the element(s) you need... then extract the text value of the element.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Any simple website could be used for that. Just read the markup into a buffer using whatever web request class Java supports, then load the markup into a DOM (again, not a java programmer, so whatever they call it) and use xpath or collection traversal to walk the objects in the DOM until you find the element(s) you need... then extract the text value of the element.

And then you have to hope the structure of the website doesn't change because it will break your app.
 

BoberFett

Lifer
Oct 9, 1999
37,562
9
81
Do you have control of the website or is this a third party website? If it's yours, set up web services on the server so you can save the hassle of extracting the info you need, and you can just use function calls to get the data.
 
Jan 23, 2006
167
0
76
Do you have control of the website or is this a third party website? If it's yours, set up web services on the server so you can save the hassle of extracting the info you need, and you can just use function calls to get the data.

I do not have direct control of the website. But the people I am doing this for do have control of it.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
I do not have direct control of the website. But the people I am doing this for do have control of it.

Can you get them to add a little structured XML file or JSON containing the data that you need? It should be fairly trivial for them to do.
 
Last edited:

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
And then you have to hope the structure of the website doesn't change because it will break your app.

Naturally. If there are options other than scraping the page, like setting up a service entrypoint, then that is preferable.