Replacing revXML()

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Replacing revXML()

Post by Mag » Wed Oct 08, 2014 11:55 am

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>

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5145
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Replacing revXML()

Post by Mark » Wed Oct 08, 2014 3:16 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Replacing revXML()

Post by Mag » Thu Oct 09, 2014 9:29 am

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!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5145
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Replacing revXML()

Post by Mark » Thu Oct 09, 2014 9:43 am

Cool :-) Let me know if you have questions.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Mac OS”