[RESOLVED, SORTA] XML files and table concatenation

I am using this code to deal with XML files:

https://github.com/Cluain/Lua-Simple-XML-Parser

This is what my XML files look like:

\<?xml version="1.0" encoding="utf-8"?\> \<library\> \<gametype1\> \<category name=""\> \<answer\>\</answer\> \<answer\>\</answer\> \<answer\>\</answer\> \</category\> \<category name=""\> \<answer\>\</answer\> \<answer\>\</answer\> \<answer\>\</answer\> \</category\> \</gametype1\> \<gametype2\> \<category name=""\> \<answer\>\</answer\> \<answer\>\</answer\> \<answer\>\</answer\> \</category\> \<category name=""\> \<answer\>\</answer\> \<answer\>\</answer\> \<answer\>\</answer\> \</category\> \</gametype2\> \</library\>

Here is my code for loading the XML files:

gameAnswers1 = xml:loadFile( "file1.xml", system.ResourceDirectory ) gameAnswers2 = xml:loadFile( "file2.xml", system.ResourceDirectory ) gameAnswers1Gametype1 = {} gameAnswers1Gametype1 = gameAnswers1.library.gametype1 gameAnswers1Gametype2 = {} gameAnswers1Gametype2 = gameAnswers1.library.gametype2 gameAnswers2Gametype1 = {} gameAnswers2Gametype1 = gameAnswers2.library.gametype1 gameAnswers2Gametype2 = {} gameAnswers2Gametype2 = gameAnswers2.library.gametype2

What I would like to do now is concatenate the tables so that I have just one table of gametype1 data and one table of gametype2 data.

I’ve tried some different code online trying to concatenate gameAnswers1Gametype1 and gameAnswers2Gametype1 into gameAnswers1Gametype1.

But when I try them, one of two things happens:

  1. When I access #gameAnswers1Gametype1.category , the number of entries is the number of entries from the original first table without any from the second table added in.

  2. When I access #gameAnswers1Gametype1.category , the number comes back as nil because it cannot be accessed.

Any ideas how I can get the tables concatenated?

I solved this, mostly, buy using a different XML parser (https://developer.anscamobile.com/code/much-improved-dump-function-and-xml-simplify) and some code provided by someone on Stack Overflow.  Likely, the issue that was blocking me affected both XML parsers and the code that I was given would work with either, provided that you are copying more than one node.

Further information in this thread:

http://forums.coronalabs.com/topic/17620-extra-xml-support/

I solved this, mostly, buy using a different XML parser (https://developer.anscamobile.com/code/much-improved-dump-function-and-xml-simplify) and some code provided by someone on Stack Overflow.  Likely, the issue that was blocking me affected both XML parsers and the code that I was given would work with either, provided that you are copying more than one node.

Further information in this thread:

http://forums.coronalabs.com/topic/17620-extra-xml-support/