Page 1 of 1

External file with settings (like .xml)?

Posted: Mon Aug 29, 2011 12:25 pm
by cu3e
Hello, today I have the following question.

Does LiveCode support external setting files like .xml or any other possibility?

I want to archive the following.

A LiveCode App calls a specific file (team_settings:xml) for example which is on a server. All LIveCode Clients can connect to the file. The file host a couple of simple Variables with a Picture Link. Example:

Code: Select all

<member_id>00001</member_id>
<member_name>Joe Doe</member_named>
<member_picture>[/server/pictures/member00001.png]</member_picture>
<member_title>Executive Officer</member_title>
<member_phone>0000.0000.000</member_phone>
<member_email>joe.doe@company.com</member_email>

<member_id>00002</member_id>
<member_name>Lisa Doe</member_named>
<member_picture>[/server/pictures/member00002.png]</member_picture>
<member_title>Artist</member_title>
<member_phone>0000.0000.000</member_phone>
<member_email>lisa.doe@company.com</member_email>
The LiveCode App pulls all infos and show it like the picture and credentials.

The reason why I want use a external script is that I can easily add more entries without changing all LiveCode Apps.


It that possible, if yes? Any tutorials available?

Re: External file with settings (like .xml)?

Posted: Mon Aug 29, 2011 1:50 pm
by Klaus
Hi cu3e,

sure this is possible :D

Load the file:

Code: Select all

...
put url("http://www.yourserver.com/thefile.xml") into tXMLFile

## Check for possible problems!
if the result <> empty then
  answer "Error" && the result"
 exit to top
end if
## Now you can parse your XML and extract what you need.
...
Check this url to get started with XML:
http://www.troz.net/rev/
Scroll down to "Sample stacks" -> "xmldemo1"


Best

Klaus

Re: External file with settings (like .xml)?

Posted: Mon Aug 29, 2011 2:07 pm
by cu3e
Great! Thank you Klaus.

But how do I put a xml string into a field? Like

Code: Select all

<CATALOG>
<CD>
<NUMBER>1</NUMBER>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<NUMBER>2</NUMBER>
<ARTIST>Bonnie Tylor</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
I want the Artist from CD 2 in Field "1" ?

put "artist" from "CD 1" into field "1"?

Re: External file with settings (like .xml)?

Posted: Mon Aug 29, 2011 3:03 pm
by Klaus
Hi cu3e,

well, this not something that can be explained in a few sentences here!
Check the above url to get used to XML in general and in LiveCode :D


Best

Klaus

Re: External file with settings (like .xml)?

Posted: Mon Aug 29, 2011 10:26 pm
by jmburnod
Hi cu3e,
But how do I put a xml string into a field?
I've done a little stack, one way to make the job (in attachment)

Best regard

Jean-Marc

Re: External file with settings (like .xml)?

Posted: Tue Aug 30, 2011 12:49 pm
by cu3e
jmburnod wrote:Hi cu3e,
But how do I put a xml string into a field?
I've done a little stack, one way to make the job (in attachment)

Best regard

Jean-Marc

Thank you very much jean-Marc, thats awesome! But where can I found the script? The only script I found was on that search button

Code: Select all

on mouseUp
   debGetArtist
end mouseUp
where/what is this "deb"?

Re: External file with settings (like .xml)?

Posted: Tue Aug 30, 2011 1:19 pm
by Klaus
Hi cu3e,

always check the card (here you find the debGetArtist handler) and stack script(s), too! 8)
And the groups script, if the object is part of a group.


Best

Klaus

P.S.
Jean-Marc provided a cool search script :D , but this has nothing to do with XML!

Re: External file with settings (like .xml)?

Posted: Tue Aug 30, 2011 3:21 pm
by jmburnod
Hi cu3e,
where can I found the script
It is in the card script

Klaus said :
Jean-Marc provided a cool search script , but this has nothing to do with XML!
Yes, i don't know XML (at this moment) :D

Best from Geneva

Jean-Marc

Re: External file with settings (like .xml)?

Posted: Tue Aug 30, 2011 4:30 pm
by Klaus
Bonjour Jean-Marc,

the hint (... not XML) was for cu3e :D

But if you need to dive into XML in LiveCode at some time, check Sarah's above mentioned stack!
Very informative, it got me started with XML!


Best

Klaus

Re: External file with settings (like .xml)?

Posted: Tue Aug 30, 2011 7:19 pm
by jmburnod
Guten Abend Klaus,
the hint (... not XML) was for cu3e :D
To late. I was so angry after your post i have eaten my computer :shock:
check Sarah's above mentioned stack! Very informative, it got me started with XML!
Oh yes.I downloaded it.Good job, clever approach.
I'm sur it will be very useful.
Thank again fo that

Jean-Marc

Re: External file with settings (like .xml)?

Posted: Wed Aug 31, 2011 11:19 am
by Klaus
Bonjour Jean-Marc,
jmburnod wrote:Guten Abend Klaus,
the hint (... not XML) was for cu3e :D
To late. I was so angry after your post i have eaten my computer :shock:
LOL :D

And, was it tasty? 8)