Using large XML data – 3Mbyte file

About Monkey 2 Forums Monkey 2 Programming Help Using large XML data – 3Mbyte file

This topic contains 13 replies, has 5 voices, and was last updated by  codifies 2 years, 2 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #6815

    monkeyplotter2
    Participant

    Hi folks,

    [EDIT] – solved in post #13, I needed to add the #imports “1p7.xml” to the top of the file….

    I’m new to using XML to parse data, so maybe I should be off learning how to parse data with XML prior to trying to do it….

    I’m inclined to put specific data I want from an XML file thats been opened into specific arrays for manipulation.

    Is there a way to break down a 3Mbyte XML file so its more digestible by Monkey2? I’ve tried to use my version of the tinyXML parser to achieve this goal however my 3MByte data file is a bit too chunky for the tinyXML parser ;(

    I’ve written bespoke data parsers in Blitz3D and MonkeyX, however they also have issues with my 3MByte XML file. (Errm, they crash !) The good thing about this is it is giving me the impetus to get my teeth stuck into Monkey2.

    Any help appreciated.

    #6819

    Diffrenzy
    Keymaster

    Can you post the xml, or another xml file that crashes tinyXML in a similar way?

    I would think this is a case of finding the error that causes the crash.

    I am also very interested in having a super stable XML parser and just ported Monkey-X xml code to MX2 tinyXML without issues.

    #6820

    codifies
    Participant

    definitely recommend you feed that xml file through an xml validator (theres a bunch of online ones)

    personally I feel that size of file you’re starting to get to the practical limits for xml in terms of being a robust data encapsulation, on mangled character can bork the whole data set in difficult to find / fix way…

    consider sqlite (you can always back up to SQL statements also a very portable way to convert the data)

    if you really have found an issue with a *valid* xml and tinyxml you should report it, also you might consider seeing if you can run it through tinyxml2

    #6849

    monkeyplotter2
    Participant

    codifies, thank you for your suggestions – I suspect it is valid (its a bespoke tcx file type, possibly its not ‘totally’ xml valid…).

    I am going to try the XML validator you’ve suggested, tried the one on W3 schools and it has no errors. I appreciate your point about approaching the cut off for ‘usable’ files. I’ll attempt to create another 3MByte sized file for trialling purposes.

    The XML in question is GPS data which has data saved every second, hi-resolution GPS data.

    “I am also very interested in having a super stable XML parser and just ported Monkey-X xml code to MX2 tinyXML without issues. ” — good stuff.

    #6851

    cocon
    Participant

    I would definitely be sure that 3MB is a reasonable size and that the TinyXML is solid.

    Just out of curiosity if you parse the XML file with another programming language what will happen?
    https://www.tutorialspoint.com/python/python_xml_processing.htm

    P.S. I don’t know also if there is an encoding issue as well, is the file UTF8?

    #6859

    monkeyplotter2
    Participant

    Hi, I’ve generated a (slightly) smaller file. its only 1.7Megs and W3C schools XML validates the file. Unfortunately this file (uploaded to the hyperlink below) seems a little bloaty still. I’ve never used python before and don’t have time before I go to work to try out your suggestion. Nevertheless – here’s the 1.7 meg tcx file in question:

     

    hmmm, well, have uploaded my tcx file to my website, but it seems you cannot directly access a 1.7megs file of tcx file type. other stuff still links ok though. Too much brainache for first thing:

    http://www.wishingwellsoftware.co.uk/powerup.png

    #6860

    Diffrenzy
    Keymaster

    Can you zip the file?

    Also: Sometimes renaming to .xml sometimes circumvents un-allowed filetypes download.

    #6882

    monkeyplotter2
    Participant

    Hmm tried changing the extension to xml first, failed, thanks for the compression suggestion – wow, it gets it down to  a fraction of the size, only 64KBytes 😉  Even uploaded it to these forums, which is sweet.

    http://www.wishingwellsoftware.co.uk/2megs.rar

    Yay, finally got it uploaded in a .rar file.  This is a slighlty smaller 1.8MegByte tcx / xml file – right – gotta get ready for that work thing.

    Attachments:
    1. 2megs.rar
    #6885

    Diffrenzy
    Keymaster

    I’ve tested your file with banana/tinyxml2_test.monkey2 and it seems to load and display without any issues.

    (macOS, latest monkey2 )

    #6912

    monkeyplotter2
    Participant

    Ah, interesting. Trying now on my W7 box ….  Mac beats Windows on this occasion, even tried changing the tcx extension to xml, no dice:

    Failed to parse embedded XML!
    SDL_WINDOWEVENT_FOCUS_GAINED

    Finished debugging app.

    #6914

    Mark Sibly
    Keymaster

    Tested with tinyxml2_test and onemegs.xml file on Windows and it worked fine…

    Are you loading the xml file properly? Check it’s not loading a null string is a good idea.

    #6915

    Diffrenzy
    Keymaster

    @monkeyplotter: My guess is you are not getting the asset or name correct. Here is a complete working example:

    #6918

    monkeyplotter2
    Participant

    thanks for the help, I was failing to add the line ‘#imports “1p7.xml”‘ at the top of the code…. doh!

    I only sussued this after wondering why there was a dream.xml copied to the Windows /assets folder but no 1p7.xml.

    Solved, maybe I should stick to riding my bike 😉

    Attachments:
    #6920

    codifies
    Participant

    easy done I spent ages looking at

    [/crayon]

    when it should have been

    [/crayon]
Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.