Dr. Strangelove (or: How I Learned to Stop Worrying and LoveXML)

Bill Marriott wjm at wjm.org
Tue Jan 16 17:44:45 EST 2007


The problem with XML is that people can do any old thing they want with it. 
While the RULES are ridiculously strict, the implementations can drive you 
nuts. For example, look at the cookies.plist file on a Mac. It has a really 
wacky setup that I think makes it all but impossible to parse with the 
RevXML library without "walking" through it. Its something like:

<person>
  <attributes>
    <field>Name</field>
    <value>Bill</value>
    <field>EyeColor</field>
    <value>Blue</value>
  </attributes>
</person>

Whereas the Rev library seems to make it easier to do something like:

<person name="Bill" eyecolor="blue" />

To be honest, I usually poke around in Sarah's stack and then figure out 
which function(s) I need through trial and error. It's just harder for me to 
"visualize" what I want to accomplish with XML.

I can say that once you figure out what two or three commands you need to 
use to parse an XML file, it's way faster than using chunk expressions or 
some other method.

- Bill


"Martin Blackman" <martinblackman at gmail.com> 
wrote in message 
news:79d1bee70701150121v62fe95dcu124a65613bbcc6e at mail.gmail.com...
>I reckon people get put off by the long revXML function names and all
> the parameters. But if you are fortunate enough to have Galaxy, it
> makes things easier - you type the first few characters then use the
> autocomplete function!
> Before long you will find loops such as the following to be second nature:
>
> put revXMLrootnode(tID) into tnode
> put revXMLfirstchild(tID,tnode) into paramNode
> repeat
>    get revXMLAttribute(tID,paramNode,"name")
>    if not (it contains "xmlerr") then
>       put it into tname
>       put tname & comma after tparamlist
>    end if
>     put revXMLNextSibling(tID,paramNode) into paramNode
>     if paramNode is empty then exit repeat
> end repeat
> delete char -1 of tparamlist
>
> regards
> Martin
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 






More information about the use-livecode mailing list