Page 1 of 1

Replacing revXML()

Posted: Wed Oct 08, 2014 11:55 am
by Mag
How aready explained here: http://forums.livecode.com/viewtopic.ph ... 56#p111556 , I must to replace all the LiveCode standard components in my, until yesterday, ready-to-release-app.

Somebody of you LiveCode gurus, can you help me to read this file without the use of RevXML?

Code: Select all

<english>

	<forversion8>
		<lastversion>810</lastversion>
		<downloadurl>http://www.mymacapp.com/downloads/</downloadurl>
		<titletext>Software Update</titletext>
		<infotext>New version 8.1 of myApp is available. The upgrade is free for all registered users.

Do you want to go download it now?</infotext>
	</forversion8>
	
</english>

Re: Replacing revXML()

Posted: Wed Oct 08, 2014 3:16 pm
by Mark
Hi,

Did you have a look at my book? It contains examples that use the revXML features as well as examples using vanilla LiveCode scripts.

You can use offset to get the location of a tag, e.g.

Code: Select all

put "<forversion8" into myTag
put offset(myTag,myXML) + len(myTag) + 1 into myStart
put slash after char 1 of myTag
put offset(myTag,myXML,myStart) - 1 into myEnd
add myStart to myEnd
This gives you the starting point and end point of the XML tree you're interested in. (I didn't test this particular example; you may have to fiddle with the +1 and -1). You can do the same with other tags. If you write a function for it, you'll be able to retrieve any tag using the same function. Sometimes, you may have to use the function multiple times:

Code: Select all

put vanillaXml("forversion8",myXML) into myTree1
put vanillaXML("downloadUrl",myTree1) into myUrl
Kind regards,

Mark

Re: Replacing revXML()

Posted: Thu Oct 09, 2014 9:29 am
by Mag
Hi Mark,

I swear that it is the only section that I have not read in your book! :wink: I'm going now to study it. Thanks!

Re: Replacing revXML()

Posted: Thu Oct 09, 2014 9:43 am
by Mark
Cool :-) Let me know if you have questions.

Mark