Hi,
I am using xml parser in my app. I am getting the xml data from the below link:
http://lhdgameslab.com/nagserver-web/rest/restService?appId=com.lhd.cricketchampsct&appVersion=1
i am getting the response but my table shows 0 entries. My code is
local xml = require(“xml”).newParser()
local function networkNagListener( event )
if ( event.isError ) then
print( “Network error!”)
elseif ( event.phase == “began” ) then
if event.bytesEstimated <= 0 then
print( “Download starting, size unknown” )
else
print( "Download starting, estimated size: " … event.bytesEstimated )
end
elseif ( event.phase == “progress” ) then
if event.bytesEstimated <= 0 then
print( "Download progress: " … event.bytesTransferred )
else
print( "Download progress: " … event.bytesTransferred … " of estimated: " … event.bytesEstimated )
end
elseif ( event.phase == “ended” ) then
print( "Download complete, total bytes transferred: " … event.bytesTransferred )
print(“event status is ========>”,event.status)
print(“event response is ========>”,event.response)
local nagData = xml:ParseXmlText(event.response)
print(“nagData Count is ================>”, #nagData)
print(“Data is ================>”, nagData.entry)
end
end
network.request( “http://puzzledash.com/proprieterynagserver-web/rest/restService?appId=com.wrestling.quizpop&appVersion=1”, “GET”, networkNagListener )
i run with this code my log shows
2013-07-24 13:21:49.561 Corona Simulator[888:707] event status is ========> 200
2013-07-24 13:21:49.561 Corona Simulator[888:707] event response is ========> <entry><nags><itemCount>7</itemCount><nag><id>305</id><type>5Skips</type><title><![CDATA[5Skips0]]></title><status>On</status><level>Level_2</level><skips>5</skips><nagTitle><![CDATA[Skips]]></nagTitle><nagBody><![CDATA[Do you want skips?]]></nagBody><priority>8</priority></nag><nag><id>307</id><type>1990s</type><title><![CDATA[1990s0]]></title><status>On</status><level>Level_3</level><skips>0</skips><nagTitle><![CDATA[Unlock 90s]]></nagTitle><nagBody><![CDATA[unlock 90s]]></nagBody><priority>1</priority></nag><nag><id>308</id><type>15Hints</type><title><![CDATA[15Hints0]]></title><status>On</status><level>Level_3</level><skips>0</skips><nagTitle><![CDATA[15 hints]]></nagTitle><nagBody><![CDATA[15 hints]]></nagBody><priority>4</priority></nag><nag><id>309</id><type>Modern</type><title><![CDATA[Modern0]]></title><status>On</status><level>Level_4</level><skips>0</skips><nagTitle><![CDATA[modern]]></nagTitle><nagBody><![CDATA[unlock category]]></nagBody><priority>3</priority></nag><nag><id>268</id><type>UnlockNext</type><title><![CDATA[UnlockNext0]]></title><status>On</status><level>Level_5</level><skips>0</skips><nagTitle><![CDATA[Unlock Next Level]]></nagTitle><nagBody><![CDATA[Unlock Next Level]]></nagBody><priority>5</priority></nag><nag><id>269</id><type>UnlockAll</type><title><![CDATA[UnlockAll0]]></title><status>On</status><level>Level_7</level><skips>0</skips><nagTitle><![CDATA[Unlock All Levels]]></nagTitle><nagBody><![CDATA[Unlock All Levels]]></nagBody><priority>4</priority></nag><nag><id>270</id><type>RemoveAds</type><title><![CDATA[RemoveAds0]]></title><status>On</status><level>Level_9</level><skips>0</skips><nagTitle><![CDATA[Hate Ads?]]></nagTitle><nagBody><![CDATA[Remove adds form the game]]></nagBody><priority>3</priority></nag></nags><settings><turn_on_get_skips_nag>false</turn_on_get_skips_nag><number_of_days>0</number_of_days><number_of_lunched_sessions>3</number_of_lunched_sessions></settings></entry>
2013-07-24 13:21:49.563 Corona Simulator[888:707] nagData Count is ================> 0
2013-07-24 13:21:49.563 Corona Simulator[888:707] Data is ================> nil
what is the problem in the xml parsing?
please tell me…