Thanks! it works without a single problem now! 
Are there any restrictions on usage of this template? [import]uid: 24111 topic_id: 19980 reply_id: 78144[/import]
Thanks! it works without a single problem now! 
Are there any restrictions on usage of this template? [import]uid: 24111 topic_id: 19980 reply_id: 78144[/import]
I would be bothered if you repackaged it and sold it in a tool set without throwing me something. But you can use it to build your apps anyway you see fit.
[import]uid: 19626 topic_id: 19980 reply_id: 78151[/import]
Nice thanks! 
Then maybe you will see your name in the credits in one of my future apps!
[import]uid: 24111 topic_id: 19980 reply_id: 78154[/import]
Tested some different rss sites and some of them have one tiny (really tiny) problem, they miss the last char. 
This is one of the feeds that got the problem: http://www.joystiq.com/rss.xml
Edit:
Here is another: http://feeds.feedburner.com/Feber [import]uid: 24111 topic_id: 19980 reply_id: 78165[/import]
What do you mean by βLast Charβ, of each item? The itemβs description? The last char of the entire file?
[import]uid: 19626 topic_id: 19980 reply_id: 78168[/import]
Oops maybe should have told you that 
The title of each story is missing the last letter/number/symbol [import]uid: 24111 topic_id: 19980 reply_id: 78170[/import]
Both of those feeds have the title embedded in a tag to protect HTML text or other character data that would look like malformed XML to the RSS namespace.
Looks like itβs in the xml.lua file line 109
top.value = (top.value or ββ)β¦xmlText:sub(abs,cdata_end-2)
change the -2 to a -1 and see how that works.
[import]uid: 19626 topic_id: 19980 reply_id: 78181[/import]
Thank you! 
But can that screw up other feeds? Or can I set an if statement that chooses -1 or -2 [import]uid: 24111 topic_id: 19980 reply_id: 78184[/import]
It only affects RSS tags that contain CDATA tags in side them. This was likely shorting a character previously. Iβve written to the author of xml.lua for advice, but for right now, lets see how it behaves for you.
[import]uid: 19626 topic_id: 19980 reply_id: 78186[/import]
I added some swedish letters to the xml file cause it seemed to have some problems with those characters on some sites. The problem was that if I printed all the story titles to the terminal it replaced them with a ? but if I used display.newText to print them on the screen, it left a blank row instead.
So I added them to the UTF-8 list but it didnβt helt at all
Any ideas?
My xml.lua file:
[code]
module(β¦, package.seeall)
function newParser()
local DEBUG = false
XmlParser = {};
function XmlParser:ToXmlString(value)
value = string.gsub (value, β&β, β&β); β β&β -> β&β
value = string.gsub (value, " β<β
value = string.gsub (value, β>β, β>β); β β>β -> β>β
βvalue = string.gsub (value, βββ, βββ); β βββ -> βββ
value = string.gsub (value, ββ", ββ"); β β"β -> ββ"
β replace non printable char -> " "
value = string.gsub(value, β([^%w%&%;%p%\t%])β,
function Β©
return string.format("%X;", string.byteΒ©)
βreturn string.format("%02X;", string.byteΒ©)
βreturn string.format("%02d;", string.byteΒ©)
end);
return value;
end
if h == β8217β or h == β8216β or h == β8218β then return βββ end
if h == β8211β then return β-β end
if h == β8212β then return βββ end
if h == β8230β then return ββ¦β end
if h == β8220β or h == β8221β or h == β8222β then return ββ" end
if h == β8214β then return ββ’β end
if h == β8226β then return β.β end
if h == β229β then return βΓ₯β end
if h == β197β then return βΓ
β end
if h == β228β then return βΓ€β end
if h == β196β then return βΓβ end
if h == β246β then return βΓΆβ end
if h == β214β then return βΓβ end
if tonumber(h) >= 1000 then return ββ end
return string.char(tonumber(h,100))
end);
value = string.gsub (value, ββ", ββ");
value = string.gsub (value, βββ, βββ);
value = string.gsub (value, β>β, β>β);
value = string.gsub (value, β<β, " value = string.gsub (value, β&β, β&β);
return value;
end
function XmlParser:ParseArgs(s)
local arg = {}
string.gsub(s, β(%w+)=([ββ])(.-)%2", function (w, _, a)
arg[w] = self:FromXmlString(a);
end)
return arg
end
function log(β¦)
if DEBUG then
print("XmlParser: ", unpack(arg))
end
end
function XmlParser:ParseXmlText(xmlText)
local stack = {}
local top = {name=nil,value=nil,properties={},child={}}
table.insert(stack, top)
local ni,c,label,xarg, empty,cdata_end,cdata_end2,abs
local i, j = 1, 1
while true do
ni,j,c,label,xarg, empty =
xmlText:find("", i)
if not ni then break end
local text = string.sub(xmlText, i, ni-1);
local cdata_start,cdata_start2 = text:find(" if (cdata_start) then
abs = i+cdata_start2
log(βFound CDATA start tagβ, abs)
cdata_end,cdata_end2 = xmlText:find("%]%]>",i)
log(βFound CDATA end tagβ, cdata_end2)
i = cdata_end2+1
else
i = j+1
end
if not cdata_start and not string.find(text, β^%s*$β) then β skip white space
top.value=(top.value or ββ)β¦self:FromXmlString(text);
end
if cdata_start then β CDATA
top.value = (top.value or ββ)β¦xmlText:sub(abs,cdata_end-1)
elseif empty == β/β then β empty element tag
table.insert(top.child, {name=label,value=nil,properties=self:ParseArgs(xarg),child={}})
elseif c == ββ then β start tag
top = {name=label, value=nil, properties=self:ParseArgs(xarg), child={}}
table.insert(stack, top) β new level
log(βopenTag =ββ¦top.name);
else β end tag
local toclose = table.remove(stack) β remove top
log(βcloseTag=ββ¦toclose.name);
top = stack[#stack]
if #stack < 1 then
error("XmlParser: nothing to close with "β¦label)
end
if toclose.name ~= label then
error("XmlParser: trying to close with ")
end
table.insert(top.child, toclose)
end
end
local text = string.sub(xmlText, i);
if not string.find(text, β^%s*$β) then
stack[#stack].value=(stack[#stack].value or ββ)β¦self:FromXmlString(text);
end
if #stack > 1 then
error("XmlParser: unclosed "β¦stack[stack.n].name)
end
βlocal xml_obj = XmlObject(stack[1].child[1])
return stack[1].child[1];
end
function XmlParser:loadFile(xmlFilename, base)
if not base then
base = system.ResourceDirectory
end
local path = system.pathForFile( xmlFilename, base )
local hFile, err = io.open(path,βrβ);
if hFile and not err then
local xmlText=hFile:read("*a"); β read file content
io.close(hFile);
return self:ParseXmlText(xmlText),nil;
else
print( err )
return nil
end
end
return XmlParser
end
[/code] [import]uid: 24111 topic_id: 19980 reply_id: 78306[/import]
Hi
I took youf file but donβt work
C:Runtime error: error loading module βrssβ from file βc:\documents an
ings\erasmo\desktop\rssgiralatina\rss.luaβ:
c:\documents and settings\erasmo\desktop\rssgiralatina\rss.lua:27: β)β e
d near '"); β β"β
traceback:
C: ?
C: ?
C: in function 'r
[import]uid: 100428 topic_id: 19980 reply_id: 95445[/import]
Can you post your rss.lua file in between < code> and < /code> tags (leaving out the spaces?) in its entirety?
[import]uid: 19626 topic_id: 19980 reply_id: 95729[/import]
Now
Itβs works
Thanks [import]uid: 100428 topic_id: 19980 reply_id: 95735[/import]