Page 1 of 1

XMLParser & SerializeTable() / DeserializeTable()

Posted: Mon Mar 29, 2021 5:59 pm
by mrupp
Hi there

I am trying to convert XML to a table. First, I tried to convert the example from Docs/XMLParser/lom.html but couldn't get it to run. I tried:

Code: Select all

@REQUIRE "xmlparser"

s = [[<abc a1="A1" a2="A2">inside tag abc</abc>]]
tab = xmlparser.lom.parse(s)
Error: Table field "lom" was not initialized!


Then, I found this post which explains how to use DeserializeTable() to do exactly what I wanted:
viewtopic.php?f=18&t=2260&hilit=xmlparser

Unfortunately, I can't even get the example for SerializeTable() to run:

Code: Select all

@REQUIRE "xmlparser"

t = {test = 1, bla = "Hello World", table1 = {table2 = {table3 = {af = "test"}}}, cool = "Hello & How are you\"'<>&", 1, 2, 3, 4, 5,
	subnode = {1,2,3,4,5, yooguys = 0.4567}, yeah = "12345", functest = Function(a, b, c)
		DebugPrint("Hello World this is a test", a, b, c) EndFunction}
a$ = SerializeTable(t, "xmlparser")
DebugPrint(a$)
The error says: Cannot find plugin xmlparser!

The plugin is installed, of course, and working (tested with this example: viewtopic.php?f=26&t=3235&p=16569&hilit ... ser#p16569).

Can anyone please try to get the SerializeTable() example to work with Hollywood 9?

Cheers,
Michael

Re: XMLParser & SerializeTable() / DeserializeTable()

Posted: Mon Mar 29, 2021 9:53 pm
by airsoftsoftwair
This requires version 1.2 of the XMLParser plugin which hasn't been released yet :)

Re: XMLParser & SerializeTable() / DeserializeTable()

Posted: Wed Mar 31, 2021 6:16 pm
by mrupp
airsoftsoftwair wrote: Mon Mar 29, 2021 9:53 pm This requires version 1.2 of the XMLParser plugin which hasn't been released yet :)
Ahhh... Now this makes sense. How about the first example above from Docs/XMLParser/lom.html? Any idea why this isn't working or what I'm doing wrong?

Re: XMLParser & SerializeTable() / DeserializeTable()

Posted: Thu Apr 01, 2021 10:38 pm
by airsoftsoftwair
mrupp wrote: Wed Mar 31, 2021 6:16 pm How about the first example above from Docs/XMLParser/lom.html? Any idea why this isn't working or what I'm doing wrong?
This is actually implemented in Lua, not in the plugin itself. See here for the source code: https://github.com/LuaDist/luaexpat/blo ... xp/lom.lua

Re: XMLParser & SerializeTable() / DeserializeTable()

Posted: Sun Dec 04, 2022 2:19 pm
by airsoftsoftwair
mrupp wrote: Mon Mar 29, 2021 5:59 pm Hi there

I am trying to convert XML to a table. First, I tried to convert the example from Docs/XMLParser/lom.html but couldn't get it to run. I tried:
This is possible now with the newly released XML plugin 2.0.