Quick XML Project: (solved)

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 417
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Quick XML Project: (solved)

Post by townsend » Mon Jun 26, 2017 3:51 am

It's been a while since I've done any coding, and now I've got a little project I need some help with.

Basically I want to read a table off a web page and populate a Data Grid. In the past I've done this with a LOT of string manipulation, but I think the right way is by using the LiveCode's XML capabilities. I should take the time to learn how to do this myself, but at this point, I'd just rather just pay someone to stub this out for me.

I want to read all 900+ rows in this table and place that into a LiveCode DataGrid:
http://coinmarketcap.com/all/views/all/
temp coinMarket.PNG
coinmarketcap.com
And I would like a couple of buttons to Save and Load the populated Data Grid.

If you're a long time LiveCode user, here in the Forum, I'll just pay you outright.
If you're a newbie, I'll pay half up front and the other half upon completion.
Send me a personal message with two quotes. One which would include a column for the coin icon. The other without the icon.
Also, let me know when you would have this ready. I'll send payment with payPal.
Last edited by townsend on Mon Jun 26, 2017 4:53 pm, edited 1 time in total.

Klaus
Posts: 9588
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Quick XML Project: (willing to pay someone)

Post by Klaus » Mon Jun 26, 2017 12:12 pm

Hmmmm, HTML <> XML! 8)

I don't think you will get far with LCs XML capabilities here, since in this case you need to parse the HTML (table) part of that page.
Or is there an XML feed on the page I didn't notice?

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 417
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: Quick XML Project: (solved)

Post by townsend » Mon Jun 26, 2017 4:39 pm

Good morning! Thank you Klaus!

Oh!! I didn't realize that HTML <> XML!

No wonder ever time I tried to "learn" how to do this, it ended up being a waste of time.

So... I have done MANY web page scraping routines before. This is well within my skill set. But thanks to Klaus, at least I won't feel guilty about coding up a 2nd rate routine when doing this.

And... for anyone who's interested in how this is done. Here's what I do, and sample of some old code. Basically I read the HTML text into a livecode Scrolling Field. Then copy an paste the HTML into a normal text editor, where I can search for some unique string. Then using that, I start chopping. Notice how I use the pos variable as a pointer to the unique string for each new segment.

Then, when it's all done, I convert all references to the livecode Scrolling Field to a simple variable, which in practice works much faster.
on mouseUp
local buyOrder, sellOrder, volume
local temp, pos
put "Getting BTC-e Quotes..." into fld "headline" of grp "menu.group"
put URL "https://btc-e.com/api/2/ltc_usd/ticker" into fld "show.here" of card "litecoinprices"
-------------
put offset("vol_cur",fld "show.here" of card "litecoinprices") into pos
put char pos +9 to 999 of fld "show.here" of card "litecoinprices" into temp
put char 1 to offset(".",temp)-1 of temp into temp
put temp into volume
--------------
put offset("buy",fld "show.here" of card "litecoinprices") into pos
put char pos +5 to 999 of fld "show.here" of card "litecoinprices" into temp
put char 1 to offset(",",temp)-1 of temp into temp
put temp into sellOrder
-----------------------
put offset("sell",fld "show.here" of card "litecoinprices") into pos
put char pos +6 to 999 of fld "show.here" of card "litecoinprices" into temp
put char 1 to offset(",",temp)-1 of temp into temp
put temp into buyOrder
post.quotes "BTC-e", buyOrder, sellOrder
end mouseUp

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”