lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Jun 03, 2005, at 12:25, Premshree Pillai wrote:

Is there a simple XML parser (preferably DOM) for Lua?

XPP rather than DOM:

http://dev.alt.textdrive.com/file/lu/LUXMLInputStream.lua

Usage example:

local anInputStream = LUXMLInputStream.new( aContent )

while ( true ) do
local aType, aContent, aName, someAttributes = anInputStream.read()

        if ( aType == nil ) then
                break
        elseif ( aType == LUXMLInputStream.Text ) then
                print( aType, aContent )
        elseif ( someAttributes ~= nil ) then
print( aType, aName, someAttributes.keys().sort().toString() )
        else
                print( aType, aName )
        end
end

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/