Building a custom GUI to configure a template

Parsing the IguanaConfiguration.xml file

The channel_info module has some simple code to load and parse the IguanaConfiguration.xml file. It is quite easy to iterate through the channels and find those which have To Translator components and list them together with the GUIDs of these Translator components. See the fossil repository layout for a reference of how this file is structured and how to get these GUIDs:

require('node')

local function trace(a,b,c,d) return end

channel_info={}

local function ReadFile(FileName)
   local F = io.open(FileName)
   local X = F:read("*all")
   F:close()
   return X
end

local function IguanaConfig()
   local X = ReadFile('IguanaConfiguration.xml')
   X = xml.parse{data=X} 
   return X
end

function channel_info.ChannelList()
   local List = {}
   local X = IguanaConfig()
   for i =1, X.iguana_config.channel_config:childCount('channel') do
      local Channel = X.iguana_config.channel_config:child('channel',i)
      if Channel.to_mapper then
         -- We have a Channel with a To Translator component
         trace(Channel)
         List[#List+1] = {name=Channel.name:nodeValue(), guid=Channel.to_mapper.guid:nodeValue()}
      end
   end
   return List
end

Leave A Comment?