cluain / lua-simple-xml-parser Goto Github PK
View Code? Open in Web Editor NEWRead simple XML easily
Read simple XML easily
I have a project that was working perfectly. I then updated the latest corona build a few days ago (Version 2013.1108 (2013.5.15)). Now when I compile the app I get an error relating to the xml parsing script xmlSimple.lua. I wonder if something has changed in the daily builds that would cause this.
Error:
Runtime error
...x/Corona dev/Mobile App v2.301/classes/xmlSimple.lua:90: attempt to concatenate field 'name' (a function value)
I haven't changed the call to the parser. It is as follows:
local xml = require("classes.xmlSimple").newParser()
local refreshXML = xml:ParseXmlText(event.response);
I know that the server response is still valid because the version of the app (compiled with the same code in the previous version of the SDK) works fine.
Thank you!
Dougi
Hello,
You should replace on line 165 :
table.insert(self.___props, { name = name, value = self[name] })
by
table.insert(self.___props, { name = name, value = self[lName] })
else the property value will always be nil.
Thanks for your work, except from this, everything work very well.
xmlTest.lua
drops multiple --: command not found
errors
PRs not merged for like 12 years, issues that are not answered for years. People, who created issues and PRs, haven't commited anything for years. is there anyone alive?
If my XML has a single entry then the table count is zero.
< results >
< match >
< hometeam >5< /hometeam >
< awayteam >4< /awayteam >
< /match >
< /results >
The result from the above is 0 records but -
< results >
< match >
< hometeam >5
< awayteam >4< /awayteam >
< /match >
< match >
< hometeam >2< /hometeam >
< awayteam >1< /awayteam >
< /match >
< /results >
The result from the above is 2 records.
Dave
Error: main.lua:2: module 'xmlSimple.lua' not found:
no field package.preload['xmlSimple.lua']
xmlSimple.lua
drops error attemp to call a nil value (global 'module')
here is the code:
local xml = require("xmlSimple").newParser() local xmlbody = [[<body><message type='chat' read_type='1' from='gambo' to='gambo' ></message></body>]] local xmlTab = xml:ParseXmlText(xmlbody) print(xmlTab.body.message['@type']) print(xmlTab.body.message['@from']) print(xmlTab.body.message['@to']) print(xmlTab.body.message['@read_type'])
the result is:
table: 0xa462f0
gambo
gambo
nil
for example i'll parse xml data from this url: http://data.bmkg.go.id/cuaca_jabodetabek_2.xml
How to do that?
Error:- access.lua:21: ERROR OCCURED -> ./LuaXMLParser.lua:144: attempt to index a function value, client: XXXXX, server: XXXXXX, request: "XXXXX HTTP/1.1", host: "XXXXX"
Please explain use of self[child:name()].name. Because error is not coming if I changed it to self[child:name()] -(.name removed)
Here is XML:
We are looking to use the project, what license is it released under?
I am using Lua 5.3 in a daw Reaper.
This xml will not be parsed:
<name>text</name>
I see the problem might be here
function node:addChild(child) if self[child:name()] ~= nil then if type(self[child:name()].name) == "function" then local tempTable = {} table.insert(tempTable, self[child:name()]) self[child:name()] = tempTable end table.insert(self[child:name()], child) else self[child:name()] = child end table.insert(self.___children, child)
end
Examples in README.md file use incorrect variable for parsing data.
Currently:
Installation
Copy the xmlSimple.lua file to your project.
Create a local variable local xml = require("xmlSimple.lua").newParser()
Read xml using xml:ParseXmlText(xmlString) or xml:loadFile(xmlFilename, base)
should be:
Installation
Copy the xmlSimple.lua file to your project.
Create a local variable local xmlParser = require("xmlSimple.lua").newParser()
Read xml local xml = xmlParser:ParseXmlText(xmlString) or local xml = xmlParser:loadFile(xmlFilename, base)
Hi,
I could not locate License and Copyright Information of Lua-Simple-XML-Parser. Really appreciate if you could you please share the same.
$ lua52 test2.lua
c:\Program Files\LuaShell\lua52.exe: .\xmlSimple.lua:105: attempt to index global 'system' (a nil value)
stack traceback:
.\xmlSimple.lua:105: in function 'loadFile'
test2.lua:3: in main chunk
[C]: in ?
Code:
local xml = require("xmlSimple").newParser()
local xmlData= xml:loadFile("C:/luaStudy/t.xml")
print(#xmlData.test)
In the XmlTest.lua and XmlSimple.lua,I can find the method what can transform the xml string to the node object. but,I can't find the other method what can transform node object to the xml string.
I have a test XML string with the XML Declaration line .
local testXml = ''
testXml = testXml .. 'access>'
testXml = testXml .. 'status>1 status>'
testXml = testXml .. 'project>2 project>'
testXml = testXml .. 'clients>* clients>'
testXml = testXml .. 'ver>1.1 ver>'
testXml = testXml .. 'url>itms-services://?action=download-manifest&url=url url>'
testXml = testXml .. 'access>'
(i removed the < and </ code because it seems GitHube removes the nodes tags if i didn't)
I'm using this code to access the first node value:
local parsedXml = xml:ParseXmlText( testXml )
local status = parsedXml.access.status:value()
When I try to get the value of the first node (status) i get this:
1It only happens with the first value, in this case status. If I get the value of the second node (project), i get 2, which is fine.
When I remove the declaration line, everything works fine.
I'm using Corona SDK 2.0 release 2012.730
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.