User Tag List

Results 1 to 5 of 5

Thread: Converting HTML to usable data

  1. #1
    Clicker Fusion 2.5Android Export ModuleSWF Export Module

    Join Date
    Sep 2013
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting HTML to usable data

    Hello!

    I would really like to use the GET object to download the source HTML from a website and then parse that information somehow to split everything into easily usable values, for instance
    If I had this HTML

    <!DOCTYPE html>
    <html>
    <body>

    <h1>My First Heading</h1>
    <a href=http://www.w3schools.com>This is a link</a>
    <a href=http://www.w3schools.com>This is also a link</a>
    <p>My first paragraph.</p>

    </body>
    </html>


    I would like to be able to loop through it all to convert it into some values like

    H10text="My First Heading"
    Link0URL="http://www.w3schools.com"
    Link0Description="This is a link"
    Link1URL="http://www.w3schools.com"
    Link1Description="This is also a link"
    P0text="My first paragraph"


    I've tried using the string parser using '<' and '>' as delimiters, but then I end up with something like this (example of first few lines)

    !DOCTYPE html
    html
    body
    h1
    My First Heading
    /h1
    a href=http://www.w3schools.com
    This is a link
    /a


    This is okay, because I can use the string parser to get specific elements by looping through them something like

    On loop "elements" +
    If element ="h1" -> set Link0Description to (getElementById(Loopindex"loop"+2)),


    But that only works when there are not additional things like this

    <P><FONT SIZE="4" FACE="Arial, Helvetica, sans-serif">Some example text</FONT></P>

    Which has me a bit stumped right now.

    Thanks for taking the time to read this, any advice?

  2. #2
    Clicker Fusion 2.5Android Export ModuleSWF Export Module

    Join Date
    Sep 2013
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After some investigating I think I might be able to do this with the Web View object using

    GetInnerTextbyId$( "GET", >id_name<, >Tag_name<, >Index< )

    with datatypes

    GetInnerTextbyId$( "GET", "string", "string", "value" )

    However I don't know how I'm going to loop through all the tags on the page...
    Any Ideas?

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML parsing is generally very difficult, especially as there's no guarantee that it'll be perfectly formed... are you connecting to sites where you have control over the content, or are you aiming to connect to arbitrary sites? It might help to know the wider context of what you're doing.

  4. #4
    Clicker Fusion 2.5Android Export ModuleSWF Export Module

    Join Date
    Sep 2013
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, thanks for replying.
    I'm connecting to arbitrary sites, The idea generate random dungeons based off various HTML elements such as using <a href=URL> as a door to another floor, or in this case; website.

    What I really want to be able to do is this.
    1. Create an object for each HTML element I want to use, for example <a href>, <p>, <title>
    2. Store any attributes for that object as strings/varibles (im not sure if attributes is the right word here, but I mean like the text in a paragraph <p>text</p>)

    I've actually already got it working to some extent, but its not pretty.

    At the top of the picture you can see the objects that have been created for 'title' and 'a' tags, then on the right I have it displaying all of the strings saved to each object that I click...

    My method kindof sucks, if you know of and any better methods than using '<' and '>' as delimiters and looping through elements till you find a match I'd love to hear them.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's amazing I think a method like that might honestly be the best you'll get - you could put the HTML through a parser to identify all the elements first (maybe by calling the web address of a script you control to then contact the site, get the content and return the elements), but if you're connecting to a site you don't know the content of, there's no guarantee that it'll be able to be parsed.

Similar Threads

  1. Clickteam "useful resources" usable in iOS games?
    By Apex in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 27th February 2012, 06:51 AM
  2. How can a table of data be exported to HTML?
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 29th September 2010, 12:28 PM
  3. Converting HTML colour into RGB?
    By Tiles in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 6th June 2009, 01:51 PM
  4. Free video codec for commercial use, usable in mmf
    By ionside in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 13th May 2009, 04:08 PM
  5. need help in converting data
    By haim in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 2nd September 2008, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •