XMLParser & SerializeTable() / DeserializeTable()

Discuss about plugins that don't have a dedicated forum
Post Reply
User avatar
mrupp
Posts: 67
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

XMLParser & SerializeTable() / DeserializeTable()

Post 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

User avatar
airsoftsoftwair
Posts: 4615
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: XMLParser & SerializeTable() / DeserializeTable()

Post by airsoftsoftwair »

This requires version 1.2 of the XMLParser plugin which hasn't been released yet :)

User avatar
mrupp
Posts: 67
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: XMLParser & SerializeTable() / DeserializeTable()

Post 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?

User avatar
airsoftsoftwair
Posts: 4615
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: XMLParser & SerializeTable() / DeserializeTable()

Post 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

Post Reply