Good Afternoon everyone.

I am currently working on a little side project that aquires player statitical data from a website / XML Feed
getting the data is fine and using item.substring(item.indexOf("ABC"))

but what i would like to do is call a series of information and show them with in a datagrid view or a listbox of current players online in that server

the layout of the data i would be getting from the website source is the following:

<table class="table_lst table_lst_stp">
            <tr>
                <td class="col_h c01">
                    Rank
                </td>
                <td class="col_h c02">
                    Name
                </td>
                <td class="col_h c03">
                    Score
                </td>
                <td class="col_h c04">
                    Time Played
                </td>
            </tr>
            <tr>
                <td class="c01">
                    1.
                </td>
                <td class="c02">
                    <a href="/player/Peachy/70.42.74.86:28930/">
                        Peachy
                    </a>


                </td>
                <td class="c03">
                    40
                </td>
                <td class="c04">
                    14:58
                </td>
            </tr>
            <tr>
                <td class="c01">
                    2.
                </td>
                <td class="c02">
                    <a href="/player/Chubby/70.42.74.86:28930/">
                        Chubby
                    </a>


                </td>
                <td class="c03">
                    0
                </td>
                <td class="c04">
                    11:26
                </td>
            </tr>
        </table>

I am not sure how i can split this into their own data for Playername, score and time online.
would i use an array ?

some help on how i could go about this would be really helpful.

I am writing this application in C# windows Application Enviroment

Edited 3 Years Ago by dualzNZ

If you just want to display the data the same way you got it, I suggest you use the WebBrowser component to display this exatcly HTML.

If you really want to extract the data from the HTML, manipulate it and display it on your own component, then I suggest you use and HTML parser to extract the data.

I've used HtmlAgilityPack in a couple of projects and liked it very much.
Take a look at: http://htmlagilitypack.codeplex.com/

thanks for that yes, i dont want to display extact html, just grab the data i need and display it within my own grid.

i see there is not much docuemtation on this package. if using this how would i just grab the region i would like?

cheers

Yeah, I didn't realised that. I think I had some troubles at the time that I used it.

Sorry, but I don't have much time to make an example for you now, maybe tomorrow, but I can't promise.

But if you google HTMLAgilityPack examples, or tutorial, you'll find a lot of links about it.

Hope you can make it =)

Edited 3 Years Ago by AleMonteiro

If the HTML is well formed, you can put it into an XDocument and use XPath to look up your data points. This will probably be easier, however, you need to rely on the HTML being well formed, which I find a lot of places don't bother with. :(

This article has been dead for over six months. Start a new discussion instead.