== xpath.lua == [http://www.keplerproject.org/luaexpat/ LuaExpat] is installed in the standard MIOS software. This Lua extension lets you create SAX-based XML parsers in Lua. [http://www.keplerproject.org/luaexpat/lom.html LOM] is one of these parsers is included in the !LuaExpat package. Given a XML document, LOM creates a nested table structure that replicates the XML structure. LuaXPath is a utility function that lets you use [http://www.w3.org/TR/xpath XPath] expressions to query a LOM object. In order to use xpath you must add the attached xpath.lua file to your Vera Controller. The easiest way to do this is to upload the file under the develop apps section of the interface. Once uploaded the below sample code can be used to prototype your specific needs. === Sample Code === {{{ #!lua require "xpath" local lom = require "lxp.lom" local xmlTest = [[ text of the first element text of the second element ]] local lomobj = lom.parse(xmlTest) -- get all elements xpath.selectNodes(lomobj,'//element') -- get the subelement text xpath.selectNodes(lomobj,'/root/element/subelement/text()') -- get the first element xpath.selectNodes(lomobj,'/root/element[@id="1"]') }}}