Hi. I'm making a radio system with ability to add your own radio stations. It will be xml based. So i've made scipt to createfile.
But how can I get the table of station 1 and 2 at the same time.
function createFileHandler()
local xmlFile = xmlCreateFile("stations.xml","stations")
local stationInfo = xmlCreateChild(xmlFile, "station")
xmlNodeSetAttribute(stationInfo, "name", "Welcome to our serve")
xmlNodeSetAttribute(stationInfo, "url", "Is the color")
local stationInfo1 = xmlCreateChild(xmlFile, "station")
xmlNodeSetAttribute(stationInfo1, "name", "Welcome to our serve")
xmlNodeSetAttribute(stationInfo1, "url", "Is the color")
xmlSaveFile(xmlFile)
end
addCommandHandler("createfile", createFileHandler)
function createFileHandle1r()
local meta = xmlLoadFile ( "stations.xml" )
local info = xmlFindChild ( meta, "station", 0 )
if info then
local attrs = xmlNodeGetAttributes ( info )
for name,value in pairs ( attrs ) do
outputChatBox( value )
end
end
xmlUnloadFile ( meta )
end
addCommandHandler("ce", createFileHandle1r)
And xml.
"Welcome to our serve" url="Is the color">
"Welcome to our serve" url="Is the color">