How do I export array as XML

0 favourites
  • 6 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello all, recently returned to Construct and I need to make prototype of one simple database like system, I know construct may not be the best place where to make it, but it was actually asked to be done here

    So The problem is I have several 2d arrays I need to export as XML, I know they can be exported as json files, but I need XML, is there any simple way to do it ?

    I did search a little and only found some posts about loading xml, not downloading it.

    All I need is to be able with clicking button to download xml version of array (much like when downloading json) to local storage.

    Xmls dont need to be complicated, just basic stuff, so they can be actually imported in another system (not my problem what happens at their end as far as I can get something what can be exported)

    Thanks !!

  • I'm puzzled by this question.

    C2 offers JSON as "export" data format, but not XML.

    In the absolute though, you could build your own XML file out of an array, but you have to implement it all in order to do so.

    You have to first check the array's dimensions to determine whether it is a one, two or three dimension(s) array.

    You have then go through each X, Y and Z of the array as required, and save tags/values for each cell.

    You can save all this in a text variable and display it in a TextBox.

    Unfortunately, I doubt you will be able to offer it for download, like a JSON file since this action (Download XML) is not available.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I do not know much abount construct, but Yes I started this converting process, was just wondering maybe there already is some kind of plugin or something what could make it easier. As far as I can somehow download text file with string (Xml code) I guess it will be fine .

  • Mr1H

    I've done this in C2. It's not especially difficult, just plan out your XML schema so that certain X/Y coordinates are used for different values in the XML.

    For example, this is my format for weapon settings:

    WeaponID is from 0, Y. WeaponName is in 1, Y, etc. Implementing it as a function that loops through all of an array's rows/columns is fairly straightforward if you plan ahead.

    Kyatric[/p] Of course the file can be downloaded. It's just a text file. Invoke a download of the resulting string with the Browser object. It's a pretty good way to save user settings locally as well.

  • There is an XML builder and writer:

  • really nice find

    I'm totally overlooked this very useful rexrainbow plugin...rex_XMLWriter


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)