File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -273,14 +273,26 @@ function BaseElement:fromXML(node, scope)
273273 if child .children then
274274 for _ , stateChild in ipairs (child .children ) do
275275 local propName = stateChild .tag
276- local value = convertValue (stateChild .value , scope )
277- local capitalizedName = propName :sub (1 ,1 ):upper () .. propName :sub (2 )
278- local methodName = " set" .. capitalizedName .. " State"
276+ local value
279277
280- if self [methodName ] then
281- self [methodName ](self , stateName , value )
278+ if stateChild .attributes and stateChild .attributes .value then
279+ value = convertValue (stateChild .attributes .value , scope )
280+ elseif stateChild .value then
281+ value = convertValue (stateChild .value , scope )
282282 else
283- log .warn (" XMLParser: State method '" .. methodName .. " ' not found for element '" .. self :getType () .. " '" )
283+ log .warn (" XMLParser: State property '" .. propName .. " ' has no value" )
284+ value = nil
285+ end
286+
287+ if value ~= nil then
288+ local capitalizedName = propName :sub (1 ,1 ):upper () .. propName :sub (2 )
289+ local methodName = " set" .. capitalizedName .. " State"
290+
291+ if self [methodName ] then
292+ self [methodName ](self , stateName , value )
293+ else
294+ log .warn (" XMLParser: State method '" .. methodName .. " ' not found for element '" .. self :getType () .. " '" )
295+ end
284296 end
285297 end
286298 end
You can’t perform that action at this time.
0 commit comments