== 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. {{{ #!lua require "xpath" local lom = require "lxp.lom" local xmlTest = [[ #!xml 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"]') }}}