News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Weaknesses in exportXml
Author Message
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #1
Weaknesses in exportXml

Hi!

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
end
return newTab
end

Greetz,

Jan-Pieter

This post was last modified: 04-30-2010 10:45 AM by jpjacobs.

04-30-2010 09:54 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Weaknesses in exportXml - jpjacobs - 04-30-2010 09:54 AM
RE: Weaknesses in exportXml - JohnMurga - 04-30-2010, 08:00 PM
RE: Weaknesses in exportXml - jpjacobs - 05-01-2010, 05:44 AM
RE: Weaknesses in exportXml - JohnMurga - 10-13-2010, 05:04 AM
RE: Weaknesses in exportXml - jpjacobs - 10-13-2010, 06:14 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: