Source

GL XML Specs / TestXmlRead.lua

Full commit
package.path = package.path .. ";./SLAXML/?.lua"
local slaxml = require "slaxml"


local glxmlstring
do
	local hFile = io.open('newglspecs/gl.xml')
	assert(hFile, "Couldn't find file")
	glxmlstring = hFile:read("*a")
	hFile:close()
end

local parser = slaxml:parser{
	startElement = function(name,nsURI) print(name) end,
	attribute    = function(name,value,nsURI) end,
	closeElement = function(name,nsURI)       end,
	text         = function(text)             end,
	comment      = function(content)          end,
	pi           = function(target,content)   end,
}

parser:parse(glxmlstring, {stripWhitespace=false})