Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function load not working #4

Open
Lucky4Luuk opened this issue Aug 4, 2017 · 2 comments
Open

Function load not working #4

Lucky4Luuk opened this issue Aug 4, 2017 · 2 comments

Comments

@Lucky4Luuk
Copy link

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

@rdlaitila
Copy link
Owner

rdlaitila commented Aug 5, 2017

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?

@EvGamer
Copy link

EvGamer commented Dec 27, 2018

I found it on Love2d wiki among recommended libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants