[deserialize85]

Description

Link: [deserialize85]
Author: Johan Sölve
Category: Technical
Version: 8.5.x
License: Public Domain
Posted: Jun. 04, 2009
Updated: Jun. 04, 2009
More by this author...
This tag can be used as replacement for [deserialize] to be able to deserialize data that contains date types and that has been serialized in Lasso 8.1 (or earlier, likely). Thanks for Bil Corry for coming up with the actual fix.

Parameters

-input string, required The XML data which should be converted into a Lasso data type.

Sample Usage

deserialize85('<customType>
	<typeName>date</typeName>
	<namespace>_global_date_</namespace>
	<member key="format">
		<stringType>%m/%d/%Y %H:%M:%S</stringType>
	</member>
	<member key="timeopt">
		<booleanType>false</booleanType>
	</member>
	<member key="private">
		<bytesType>AAAAAAAAAAAAAAAAAAAADAAAAAkAAAAEAAAABQAAAG0AAAAEAAAAmgAAAAEAABwgBoGrUAN9AAD////EAAAAAAAAAAAAAAAA</bytesType>
	</member>
	<private />
</customType>');
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
define_tag('deserialize85', -required='input', -copy);
	local('datebyte'=null, 'datebyte64_fixed'=null);
	local('datebytes' = string_findregexp(#input,-find='(?s)<typeName>date</typeName>.*?<bytesType>([^<]*)'));
	iterate(#datebytes, local('datebyte64'));
		if(loop_count % 2 == 0);
			#datebyte=decode_base64(#datebyte64);
			if(#datebyte -> size > 64);
				#datebyte64_fixed = encode_base64(#datebyte->getrange(4,#datebyte->size - 8));
				#input -> replace(#datebyte64, #datebyte64_fixed);
			/if;
		/if;
	/iterate;
	return(deserialize(#input));
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net