Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Parsing an html table

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
XaLeX
Expert Cheater
Reputation: 0

Joined: 19 Aug 2008
Posts: 226

PostPosted: Mon Sep 13, 2010 3:48 pm    Post subject: Parsing an html table Reply with quote

There's this table (all but the first in that page) which I find very useful but hard to use. Its purpose is to know HOW to get an item, while what i want to know is WHAT you can do with a given item.
Being lazy, I thought I could programmatically parse it and get all the data, so i could even display it in some more user-friendly view, for example:
Code:
[Fire]-,
       V
[Fire]-->[Fira]-->[Firaga]
                ^
         [Fira]-'
But it'll take something like AGES to write it in C++. So I remembered the good old days in which I knew perl: maybe some basic file i/o and a hash could do, but I'm very flexible and i like learning so anything is fine.

So, in your opinion, what's the best/fastest way to do this? (Can be broken down in two steps: parsing the original table to xml or a database or some programming-friendly thing, and data->user, that is, the program that will read the data and do stuff with it)

EDIT: found another one here (CTRL-F for "[COL:CM]", table is nearly at the end of the page) which may be easier to parse as it's in ascii.
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 893

PostPosted: Mon Sep 13, 2010 9:57 pm    Post subject: Reply with quote

Any modern programming language, including C++, has tools for parsing. For C++, I'd probably use Boost::Spirit, since it's what I know best. For Perl/Python/Ruby/etc I'd probably just scrape crap with regexps, starting w/ /.*?(\<table class=\"wiki.*?\<\/table\>)/m all the while knowing that the proper way would be to use a more correct, although verbose, library like mechanize or hpricot or something.

Cheers,
adude
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Mon Sep 13, 2010 11:26 pm    Post subject: Reply with quote

Any parser combinator should be able to handle this nicely (Boost.Spirit, Parsec, FParsec, etc).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites