Hi!
I’m using the XML.lua module to display information from a xml downloaded with network.download
The download process was OK and saved the network file to temporary directory correctly.
The structure of XML it’s the same of this:
[blockcode]
<?xml version="1.0" encoding="UTF-8"?>
LINK
TITLE
TITLE
DESC
LANG
LINK
LINK COMMENTS
DATE
LINK
[...]
[/blockcode]
Some lines of my app code:
[lua] local calendari = xml:loadFile("test.xml", system.TemporaryDirectory);
for i=1,#calendari.child do
contingut[i] = calendari.child[i]
end
for i=1,#contingut do
local cont = contingut[i].child[1].value
txtAgenda[i] = display.newText("Contingut: " ..cont, 0, base*5, nil, 30)[/lua]
I modify this line to see what type of information it will display:
[lua]local cont = contingut[i].child[X].value[/lua]
On "X" if I put:
1: Displays line 4 from XML code
2: Displays line 5 from XML code
3: Runtime ERROR: attempt to concatenate local 'cont' < a nil value > (in line 9 of Lua code of this post)
4: Displays line 7 from XML code
5: Displays line 8 from XML code
6: Runtime ERROR: attempt to concatenate local 'cont' < a nil value > (in line 9 of Lua code of this post)
7: Runtime ERROR: attempt to concatenate local 'cont' < a nil value > (in line 9 of Lua code of this post)
8: Runtime ERROR: attempt to concatenate local 'cont' < a nil value > (in line 9 of Lua code of this post)
I'm interesting to start to display the line 10 of XML code, I would display every ITEM's tag content of XML, but I don't know why didn't display making an error that can't concatenate the information.
Maybe the problem is on CDATA ?
I tried to modify XML.lua module adding some lines in "XmlParser:ToXmlString" function:
[lua]function XmlParser:ToXmlString(value)
value = string.gsub (value, " ", "value = string.gsub (value, " ", "]]>");
[...][/lua]
But didn't work...
Anybody can help me?
Thanks!
Gracias! ;)
(sorry for my bad english!)
[import]uid: 93601 topic_id: 17544 reply_id: 317544[/import]