Hi all,
I am in trouble to parse in a right way an XML file (meteo.xml) with the following structure:
<report>
<day value=“20151112” name=“Giovedi”>
<symbol value=“2” desc=“Poco nuvoloso”/>
<tempmin value=“13” unit=“°C”/>
<tempmax value=“17” unit=“°C”/>
<wind value=“8” unit=“km/h” symbol=“33”/>
<rain value=“0” unit=“mm”/>
</day>
<day value=“20151113” name=“Venerdì”>
<symbol value=“3” desc=“Nubi sparse”/>
<tempmin value=“11” unit=“°C”/>
<tempmax value=“16” unit=“°C”/>
<wind value=“8” unit=“km/h” symbol=“33”/>
<rain value=“0” unit="mm”/>
</day>
.
.
.
</report>
I am not able to get back the full data.
I use the following script:
local xml = require( “xml” ).newParser()
local report = xml:loadFile( “meteo.xml”, system.TemporaryDirectory )
local record_Meteo = {}
for i=1,#report.child do
record_Meteo[i] = report.child[i]
end
print (record_Meteo[1].name) —>”day"
print (record_Meteo[1].child[1].name) —>” symbol”
How can get back the values of these tags? Because if try to obtain the value the result is “nil”
print (record_Meteo[1].child[1].value) —> nil
thanks in advance for the help