This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Help with scripts for reading and searching in xml files!
#2
Hi,

Try this:
Code:
xmldata = "your XML reply"
for i in string.gmatch(xmldata, '<basic.-</basic>') do
 result = i:match([[<sourceDescription>(.-)</sourceDescription>]])
 if result ~= nil then
   grp.update('1/1/1', result)
 end
end

for i in string.gmatch(xmldata, '<basic.-</basic>') do
 result = i:match([[<sourceStatusText>(.-)</sourceStatusText>]])
 if result ~= nil then
   grp.update('1/1/2', result)
 end
end

for i in string.gmatch(xmldata, '<status.-</status>') do
 for i in string.gmatch(xmldata, '<info.-</info>') do
   selector = i:match([[<key>(.-)</key>]])
   if selector == 'AirPlay' then
     result = i:match([[<value>(.-)</value>]])
     if result ~= nil then
       grp.update('1/1/3', result)
     end
   end
 end
end
BR,

Erwin
Reply


Messages In This Thread
RE: Help with scripts for reading and searching in xml files! - by Erwin van der Zwart - 26.11.2017, 01:26

Forum Jump: