Murga-Projects Forums
Weaknesses in exportXml - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Weaknesses in exportXml (/showthread.php?tid=383)

Weaknesses in exportXml - jpjacobs - 04-30-2010 09:54 AM


Found out some weaknesses in exportXml
* it does not support io.stdout or io.stderr. Besides it would be nice to be able to export to a xml-string to, for example to insert XSL/DTD/... stuff, and not having to read it out of the file again

* It doesn't take care of keys with spaces in the tables, the first word will appear as the tag, the following ones as attributes. As a side effect this borkes the reading in by loadFromXml() as it gets <word1 word2 ...>...</word1 word2> as tags.
As a temporary workaround, replaces spaces in keys with __ :

function prepTable (tab,unprep)
local newTab={}
local pat = unprep and '__' or '%s+'
local rep = unprep and ' ' or '__'
for k,v in pairs(tab) do
newTab[(k:gsub(pat,rep))]= type(v)=="table" and prepTable(v,unprep) or v
return newTab



RE: Weaknesses in exportXml - JohnMurga - 04-30-2010 08:00 PM

On the list to fix for this weekend release ...

Thanks for reporting

RE: Weaknesses in exportXml - jpjacobs - 05-01-2010 05:44 AM

Found out another flaw in loadFromXml(): it doesn't load empty tables from the xml-file like in this one:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<LuaVariables luaType="5">
<_t luaType="5">
<_a luaType="5" />
<_b luaType="5" />
<_c luaType="4">boegawoega</_c>

after loading this, I get this from murgaLua.debug.printTable():

[t] => table
[c] => boegawoega

so the empty tables a and b just disappear.


RE: Weaknesses in exportXml - JohnMurga - 10-13-2010 05:04 AM

This is fixed in the new RC ...

And you have the new functionality you requested.

RE: Weaknesses in exportXml - jpjacobs - 10-13-2010 06:14 PM

Thanks a lot!