lua-libxml
lua-libxml copied to clipboard
Function load not working
Hey there,
I'm trying to use libxml to parse some XML (duh), but after calling require, it gives the following error: main.lua:19: attempt to call field 'load' (a nil value)
Here is a hastebin of my code, do you know what I'm doing wrong? https://hastebin.com/uxusipajub.lua
Thanks for looking,
Lucky4Luuk
this library does not have a top level load
method. It appears your error is coming from your main.lua line 19:
local xmldoc = libxml.load(data)
Instead, you have to create a DOMParser directly and parse an xml string. I believe it goes like this:
local libxml = require('xml.init')
local parser = libxml.dom.DOMParser()
local document = parser:parseFromString("<root><foo></foo></root>")
This library has not had much activity in some time and I have not made any significant updates in a while. May I ask where you found lua-libxml from?
I found it on Love2d wiki among recommended libraries