Version 2 (modified by javier_guerra, 10 years ago) (diff)



LuaExpat is installed in the standard MIOS software. This Lua extension lets you create SAX-based XML parsers in Lua. 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 XPath expressions to query a LOM object.

require "xpath"
local lom = require "lxp.lom"

local xmlTest =
<?xml version="1.0" encoding="ISO-8859-1"?>
    <element id="1" name="element1">text of the first element</element>
        <element id="2" name="element2">
        <subelement>text of the second element</subelement>

local lomobj = lom.parse(xmlTest)

-- get all elements
-- get the subelement text
-- get the first element


  • xpath.lua (4.1 KB) - added by will.schneider 23 months ago. XPath Module Required on Vera Controller