XML files

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

XML files

Post by SirWobbyTheFirst » Sun Sep 12, 2010 5:06 pm

Hi guys, I don't know which sort of topic this fits into because its for rev as well as other uses so don't clip me across the ear if its in the wrong forum. Could anyone recommend any good tutorials for reading and writing XML files because I am a complete beginner when it comes to XML and it would be sweeet!!! (Family Guy Reference Sorry) if I could be able to share data between Visual Basic (Or any non-revolution language you can think of) and Revolution using one standard.

Plus it would really sweeten the deal with my boss because I am hoping to finally be able to put my network and programming skills to some use, especially in the north east of england where computer jobs are nearly extinct. As per-se any help would be most appreciated especially now. :)

Thanks, Michael.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: XML files

Post by FourthWorld » Sun Sep 12, 2010 7:59 pm

RSS is a great starting point for playing with XML because it's both simple and useful. Check out the RSS example in the Internet section of the Rev Resource Center.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Re: XML files

Post by SirWobbyTheFirst » Sun Sep 12, 2010 8:17 pm

Alright thanks FourthWorld, I'll take a look at that. :)

EDIT: FourthWorld, I've figured out how to get rev to reference information from the XML file but I don't know how to write the XML back to disk if I make changes to it. The dictionary doesn't list any functions or commands in the XML section for performing such an action neither, could you shed some light on this situation please?

Thanks, Michael.

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: XML files

Post by hliljegren » Thu Sep 23, 2010 7:37 am

To write an XML tree to file is quite easy! There is a command called revXMLText that turns your XML tree into a text chunk, then you can use "URL" to write it to a file:

put revXMLText( xmlTreeID,,true) into URL "file:my/path/to/my/XMLFile.xml"

The double ,, is actually needed. As a second parameter you can supply a node on where to start and if you don't supply anything it will start at the tree root. The last parameter is if you want it pretty-printed or not (i.e indentation or not)
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Re: XML files

Post by SirWobbyTheFirst » Thu Sep 23, 2010 4:16 pm

Oh right, thanks for the info hliljegren, I was beginning to think I might have to just keep my Visual Basic and Rev apps seperated or use text files. Thanks alot. :)

Post Reply