Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

How Do I Display XML Data in Real Time Format?


  • Please log in to reply
3 replies to this topic

#1 blub

blub

  •  Avatar image
  • Members
  • 103 posts
  • OFFLINE
  •  
  • Local time:01:56 AM

Posted 31 August 2022 - 02:32 PM

There is an XML file on a video game website. This file shows the names of all the servers and who is currently playing, along with the name of the map they're playing. Some members of the game's Discord server took the info from that XML file and made a Discord bot that displays that info as an easy-to-read and up-to-date table.

 

Is there a way that I can take the info from that XML file and create a script that will display a similar up-to-date table in my web browser? Or is there another way to display that data somehow? I don't want to have to join the Discord server to see that info in real time.

 

I'm not sure, but I think they said they used python. I don't know anything about programming. I just know some basic HTML and that's it.



BC AdBot (Login to Remove)

 


#2 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 71 posts
  • OFFLINE
  •  
  • Local time:10:56 PM

Posted 01 September 2022 - 01:05 PM

Are you able to read the XML file without joining the Discord server? When I say read, I mean can you do anything with it; can you look at it in any way. You must be able to do that.

 

The next problem is knowing when the data changes. Unless there is something you are not telling us or do not know about, the only thing you can do is to periodically poll (read; copy) the file, then process it. Reading a XML file is often called deserializing it. How you deserialize depends on the language you are using.



#3 rp88

rp88

  •  Avatar image
  • Members
  • 3,734 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:05:56 AM

Posted 01 September 2022 - 06:25 PM

This could indeed be quite a complex task, but I've heard python has a lot of libraries to read things from webpages and other online sources. As you haven't programemd before, look for some python introductions online, then when you can write simple python programs start looking for python tutorials about reading data from the internet. Or see if you can ask the individual who made the discord bot how they did it?
Back to visiting this site, every so often, been so busy in previous years.

#4 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 71 posts
  • OFFLINE
  •  
  • Local time:10:56 PM

Posted 01 September 2022 - 06:53 PM

I've heard python has a lot of libraries to read things from webpages and other online sources

I almost mentioned Python in my reply but I decided it was getting too detailed. Python has extensive support of website scraping but as best as I remember, Python is the worst for reading XML. Well actually it depends on the library. There are at least four choices, I assume because developers considered the first couple to be insufficient.

 

If blub is ready for technical details then they can provide more details of where they want to go.

 

Something I did not mention previously is that there might be an API or service for developers to use to access the data. It is unlikely for this but it would be the right choice if it is available.

 

The answer to the question of whether the XML file can be accessed is critical to the determination of how to proceed.


Edited by SamHobbs, 01 September 2022 - 06:54 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users