Conquer Club

Generating strong XML from Excel Spreadsheets

Topics that are not maps. Discuss general map making concepts, techniques, contests, etc, here.

Moderator: Cartographers

Forum rules
Please read the Community Guidelines before posting.

Generating strong XML from Excel Spreadsheets

Postby Tieryn on Thu Jan 31, 2008 9:53 am

Creating XML from Excel

So, I figured that XML is essentially a very repetitious process, involving some standard formatting and dumping in a lot of data... Yes?

And I know a good way to store a lot of data is in a spreadsheet, easy to link, easy to connect and link various parts (co-ordinates, bonuses, attacks, bombards) etc to the territory by putting them on the same line, so I thinks to myself... If I could combine the two, I could generate all of my XML from an excel spreadsheet..

With a little bit of playing I've been successful, and have generated perfectly structured, perfectly tested and applied XML for the Hypercube map using it...

If you are interested, I'd be happy to show you what I've done and talk you through the steps and processes, so you can speed up and simplify your XML creation, as well as make it stronger and more resilient. Of course, I've still gone through the whole thing line by line checking it against the map, but it saved me 50,000 character presses.

Here's the excel file I used for generating the XML for

http://www.sendspace.com/file/rkdqjm

Which generated most of the bulky XML.

The rest I added in in notepad...

XML can be found below

http://www.sendspace.com/file/rd9x4y

Have a look through it, and if you've got any questions, post away
Last edited by Tieryn on Sat Feb 02, 2008 7:34 am, edited 1 time in total.
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One

Postby yeti_c on Thu Jan 31, 2008 9:55 am

Nice work...

Essentially using Excel to help with Copy N Paste!!

C.
Image
Highest score : 2297
User avatar
Lieutenant yeti_c
 
Posts: 9624
Joined: Thu Jan 04, 2007 9:02 am

Postby DiM on Thu Jan 31, 2008 9:58 am

upload the file and put some instructions so we can take a look.
“In the beginning God said, the four-dimensional divergence of an antisymmetric, second rank tensor equals zero, and there was light, and it was good. And on the seventh day he rested.”- Michio Kaku
User avatar
Major DiM
 
Posts: 10415
Joined: Wed Feb 14, 2007 6:20 pm
Location: making maps for scooby snacks

Postby Tieryn on Thu Jan 31, 2008 10:05 am

Trying to but my internet is being well slow and sendspace seems to be down
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One

Postby Lone.prophet on Thu Jan 31, 2008 10:11 am

man nice idea really great addition i guess
Image
Captain Lone.prophet
 
Posts: 1467
Joined: Thu Oct 12, 2006 4:37 pm
Location: Your basement Muahaha

Postby gimil on Thu Jan 31, 2008 10:16 am

Tieryn is you managed to upload the file and give a good explanation in the first post ill stick this in the map making tools.
What do you know about map making, bitch?

natty_dread wrote:I was wrong


Top Score:2403
User avatar
Corporal 1st Class gimil
 
Posts: 8599
Joined: Sat Mar 03, 2007 12:42 pm
Location: United Kingdom (Scotland)

Postby Tieryn on Thu Jan 31, 2008 10:16 am

If I don't get it done tonight, I'll do it tomorrow night gimil, my internet's just being poop.
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One

Postby bryguy on Thu Jan 31, 2008 10:42 am

i cant figure excel out >_<
Corporal bryguy
 
Posts: 4381
Joined: Tue Aug 07, 2007 8:50 am
Location: Lost in a Jigsaw

Postby Lone.prophet on Thu Jan 31, 2008 11:34 am

how come?
Image
Captain Lone.prophet
 
Posts: 1467
Joined: Thu Oct 12, 2006 4:37 pm
Location: Your basement Muahaha

Postby Coleman on Thu Jan 31, 2008 2:45 pm

Excel is pretty much how I've always done it...
User avatar
Sergeant Coleman
 
Posts: 5402
Joined: Tue Jan 02, 2007 10:36 pm
Location: Midwest

Postby bryguy on Thu Jan 31, 2008 3:41 pm

nvm i think i figured it out...


but i dont know if im doing it right
Corporal bryguy
 
Posts: 4381
Joined: Tue Aug 07, 2007 8:50 am
Location: Lost in a Jigsaw

Postby Tieryn on Thu Jan 31, 2008 4:33 pm

Well look, I can't get the file up at the moment cause some major internet link has gone down and I can't get the rest of the web. (for some reason, I -can- get conquer club! Thank god!!!)

A basic territory would look like this...

Code: Select all
<territory>      
   =CONCATENATE("<name>",Sheet1!A5,"</name>")   
   <borders>   
      =IF(Sheet1!B5="","",CONCATENATE("<border>",Sheet1!B5,"</border>"))
      =IF(Sheet1!C5="","",CONCATENATE("<border>",Sheet1!C5,"</border>"))
      =IF(Sheet1!D5="","",CONCATENATE("<border>",Sheet1!D5,"</border>"))
      =IF(Sheet1!E5="","",CONCATENATE("<border>",Sheet1!E5,"</border>"))
      =IF(Sheet1!F5="","",CONCATENATE("<border>",Sheet1!F5,"</border>"))
      =IF(Sheet1!G5="","",CONCATENATE("<border>",Sheet1!G5,"</border>"))
   </borders>   
   <coordinates>   
      =CONCATENATE("<smallx>",Sheet1!H5,"</smallx>")
      =CONCATENATE("<smally>",Sheet1!I5,"</smally>")
      =CONCATENATE("<largex>",Sheet1!J5,"</largex>")
      =CONCATENATE("<largey>",Sheet1!K5,"</largey>")
   </coordinates>   
</territory>      

Note, those "IF"s were there because I had some blank spaces, so that just didn't put a <border></border> when there was a blank.. It just left it blank.

A continent like this
Code: Select all
<continent>      
   =CONCATENATE("<name>",Sheet1!M3,"</name>")   
   =CONCATENATE("<bonus>",Sheet1!R3,"</bonus>")   
   <components>   
      =CONCATENATE("<territory>",Sheet1!N3,"</territory>")
      =CONCATENATE("<territory>",Sheet1!O3,"</territory>")
      =CONCATENATE("<territory>",Sheet1!P3,"</territory>")
      =CONCATENATE("<territory>",Sheet1!Q3,"</territory>")
   </components>   
</continent>      


and an override continent like this

Code: Select all
<continent>      
   =CONCATENATE("<name>",Sheet1!AH41,"</name>")   
   =CONCATENATE("<bonus>",Sheet1!AQ41,"</bonus>")   
   <components>   
      =CONCATENATE("<territory>",Sheet1!AI41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AJ41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AK41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AL41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AM41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AN41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AO41,"</territory>")
      =CONCATENATE("<territory>",Sheet1!AP41,"</territory>")
   </components>   
   <overrides>   
      =CONCATENATE("<override>",Sheet1!AR41,"</override>")
      =CONCATENATE("<override>",Sheet1!AS41,"</override>")
      =CONCATENATE("<override>",Sheet1!AT41,"</override>")
      =CONCATENATE("<override>",Sheet1!AU41,"</override>")
      =CONCATENATE("<override>",Sheet1!AV41,"</override>")
      =CONCATENATE("<override>",Sheet1!AW41,"</override>")
   </overrides>   
</continent>      


Basically, since the hypercube map is so patterned, all I would do is copy that into another worksheet (at the same row/col position), then copy it and move it down one row, then paste. All the links would jump down one row. Then I cut that and put it back into my "XML Generation" sheet.

Then I copied the -two- continents, did the same process, but moved down 2, and cut them back. then I did 4 and moved down 4, etc, until I got my 64 territories or whatever.

I assume it'll be slightly more difficult on a less logical/patterned map, but the principle is the same, and the copy/pasting of dynamic links will allow you to move them about to where you need them..

The basic rules you need to know are if you copy something and paste it somewhere else, the distance the cell moved, all its references will move the same. If I copy and move down 3, I'll be referring to the cell 3 lower than I was before.

If I -CUT- and paste, then the link does not change, it still refers to the same cell.

By creative use of these two, you can easily create your XML. And more, easily edit it. I left out the co-ordinates, cause I didn't have them. When I got them, I entered them -ONCE- into my original document, and the entire XML updated itself automatically.
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One

Postby edbeard on Thu Jan 31, 2008 8:22 pm

sounds like a good idea


after it's verified to be awesome, we're going to ask you to work on a 'point and click' way to do centering of coordinates.

chop chop


:)
User avatar
Lieutenant edbeard
 
Posts: 2501
Joined: Thu Mar 29, 2007 12:41 am

Postby WidowMakers on Thu Jan 31, 2008 8:47 pm

edbeard wrote:sounds like a good idea


after it's verified to be awesome, we're going to ask you to work on a 'point and click' way to do centering of coordinates.

chop chop


:)
jota already made one. i use it for all of my maps.

http://www.conquerclub.com/forum/viewtopic.php?t=1085

WM
Image
Major WidowMakers
 
Posts: 2774
Joined: Mon Nov 20, 2006 9:25 am
Location: Detroit, MI

Postby Tieryn on Fri Feb 01, 2008 4:58 am

Okay, so my Internet is no longer up the pooch, and I can access the rest of the interweb, so...

Here's the excel file I used for generating the XML for

http://www.sendspace.com/file/rkdqjm

Which generated most of the bulky XML.

The rest I added in in notepad...

XML can be found below

[url]http://www.sendspace.com/file/rd9x4y[/xml]

Have a look through it, and if you've got any questions, feel free to ask :D
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One

Postby Tieryn on Fri Feb 01, 2008 4:58 am

Okay, so my Internet is no longer up the pooch, and I can access the rest of the interweb, so...

Here's the excel file I used for generating the XML for

http://www.sendspace.com/file/rkdqjm

Which generated most of the bulky XML.

The rest I added in in notepad...

XML can be found below

http://www.sendspace.com/file/rd9x4y

Have a look through it, and if you've got any questions, feel free to ask :D
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One

Postby DiM on Fri Feb 01, 2008 9:02 am

WidowMakers wrote:
edbeard wrote:sounds like a good idea


after it's verified to be awesome, we're going to ask you to work on a 'point and click' way to do centering of coordinates.

chop chop


:)
jota already made one. i use it for all of my maps.

http://www.conquerclub.com/forum/viewtopic.php?t=1085

WM


yep great work on that by jota.
i also use it for all my maps and then i just make very small adjustments.
“In the beginning God said, the four-dimensional divergence of an antisymmetric, second rank tensor equals zero, and there was light, and it was good. And on the seventh day he rested.”- Michio Kaku
User avatar
Major DiM
 
Posts: 10415
Joined: Wed Feb 14, 2007 6:20 pm
Location: making maps for scooby snacks

Postby Tieryn on Sat Feb 02, 2008 7:35 am

Also, I put the links in the first post, so if people want to download, use and modify, feel free :)

Discuss here if you have any questions on what I've done or how to adapt it.
User avatar
Sergeant 1st Class Tieryn
 
Posts: 781
Joined: Mon May 28, 2007 7:30 am
Location: Generation One


Return to Foundry Discussions

Who is online

Users browsing this forum: No registered users