Giter VIP home page Giter VIP logo

lua-simple-xml-parser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-simple-xml-parser's Issues

Issue with new build of Corona SDK

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

Error in properties

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.

If single element then no records are returned

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

require does not work

Error: main.lua:2: module 'xmlSimple.lua' not found:
no field package.preload['xmlSimple.lua']

it don't work if xml string contain 'type' attribute

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

Not working in specific case- error on line- if type(self[child:name()].name) == "function" then

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:

1402478096996BLRIN8New Delhi and NCR DELINBangaloreBLRIN111RRfalsefalseexIndiaFPHYNN3falsedirect_fphlpINRfalseE{"sessionId":"1402478096996","TravelType":"DOM","fromCity":"DEL","toCity":"BLR","startDate":"Tue Jun 24 00:00:00 IST 2014","endDate":"Mon Jun 30 00:00:00 IST 2014","htlCity":"BLR","htlStart":"Tue Jun 24 00:00:00 IST 2014","htlEnd":"Mon Jun 30 00:00:00 IST 2014","pax":"1_1_1"B2Efreedom18201406240000201406302014-06-24T00:00:00+05:30BLRBLRININ111RNew Delhi and NCR DELSEARCH_LISTING1402478096996fphINRINR1.01402478098697BLR_IN_24062014_30062014_1|1|1|8||DEL_IN_BLR_IN_24062014_30062014_1_1_1_R_R_INR_E_false_2.8falsefalsefalsefphtrue/ns2:MMTFphSearchRequest

Incorrect handling of tags with same name as methods of node class

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

Documentation error: examples use incorrect variable

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)

License and Copyright Information

Hi,
I could not locate License and Copyright Information of Lua-Simple-XML-Parser. Really appreciate if you could you please share the same.

xmlSimple.lua:105: attempt to index global 'system' (a nil value)

$ 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)

How can i transform the object to XML String?

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.

XML Declaration and getting first nodes value.

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:

1

It 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.