Lines Matching full:xml
3 -- symbolic name for tag index, this allows accessing the tag by var[xml.TAG]
4 xml.TAG = 0
7 function xml.tag(var,tag)
10 return var[xml.TAG]
12 var[xml.TAG] = tag
16 function xml.new(arg)
18 base.setmetatable(arg,{__index=xml, __tostring=xml.str})
22 base.setmetatable(var,{__index=xml, __tostring=xml.str})
23 if base.type(arg)=="string" then var[xml.TAG]=arg end
28 function xml.append(var,tag)
30 local newVar = xml.new(tag)
35 -- converts any Lua var into an XML string
36 function xml.str(var,indent,tagValue)
49 tableStr = tableStr..xml.str(v,indent+1,k)
51 s = s.." "..k.."=\""..xml.encode(base.tostring(v)).."\""
58 s = s..">"..xml.encode(base.tostring(var[1])).."</"..tag..">\n"
63 s = s..indentStr.." "..xml.encode(v).." \n"
65 s = s..xml.str(v,indent+1)
73 return indentStr.."<"..tag.."> "..xml.encode(base.tostring(var)).." </"..tag..">\n"
78 -- saves a Lua var as xml file
79 function xml.save(var,filename)
83 file:write("<?xml version=\"1.0\"?>\n<!-- file \"",filename, "\", generated by LuaXML -->\n\n")
84 file:write(xml.str(var))
90 function xml.find(var, tag, attributeKey,attributeValue)
99 base.setmetatable(var,{__index=xml, __tostring=xml.str})
104 base.setmetatable(var,{__index=xml, __tostring=xml.str})
111 local ret = xml.find(v, tag, attributeKey,attributeValue)