Simple XML Parser
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Simple XML Parser

Started by NotRabidWombat, 19 July, 2004, 12:47:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NotRabidWombat

function XMLtoTable(sString)
	if( not sString ) then return ""; end

	local s, e, sTag, sTemp = strfind(sString, "^<([^>]-)>(.*)$");
	local sInner;

	-- we have a tag
	if(s) then
		sString = sTemp;
		local tTable = {};

		while sTag do
			s, e, sTag = strfind(sTag, "^(%S+)");

			s, e, sInner, sString = strfind(sString, "^(.-)(.*)$");

			if( not tTable[sTag] ) then
				tTable[sTag] = {};
			end

			tinsert(tTable[sTag], XMLtoTable(sInner));

			s, e, sTag, sString = strfind(sString, "<([^>]-)>(.*)$");
		end

		return tTable;
		
	-- we have data
	else
		return sString;
	end
end
Very simple parser right now. I intend to make it better.

Used it to export YHub accounts to another hub soft. Probably has a million other uses.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

Herodes

make that billion of uses ... thanks for keeping it fresh NotRambitWombat ..
Cant wait to see what else u can do :)

FlatLynr

I originally used Excel to convert my yhub accounts to Ptokax and I really wish I'd has this script then, it's much more elegant and would have saved me having to work with a 20MB spreadsheet  8o

Since I missed out on my chance to use it there, I'm going to make a (possibly foolhardy) attempt to use it to create a next gen nForce bot now that their scripts are XML. Probably just get it to generate a simple text file and use one of the timed message bots around to broadcast them although if I can get my head around the language enough (just learning), I'll try to make it into a full bot with commands etc.

I'll keep the board posted on any developments but if anyone's working on something similar, I'd love to hear how you're getting on.
[LeGioN?][RAR]FlatLynr

bastya_elvtars

hehe rabidwombat put another nail in yhub's coffin - very nice! heh heh sorry for this offtopic post but i really hate yhub! :evil:
Everything could have been anything else and it would have just as much meaning.

dkt

wats the use of this script in brief ???

and how to use it ?

SMF spam blocked by CleanTalk