XML Tutorial

Alex Rice alex at mindlube.com
Tue Jan 13 11:29:01 EST 2004


On Jan 13, 2004, at 4:09 AM, Graham Samuel wrote:

> I am using this to infer what XML is and what it's for - I know, this 
> was not Alex's intention when writing his post, but in fact it takes 
> me quite a long way.

It was my intent, more or less :-)

> However the question I can't tackle intuitively from the sample is 
> "how would I define and populate my XML tree - or whatever it's called 
> - faced with the text of 'Macbeth'?", and maybe "How general could 
> such a parser/populator be? Once constructed - presumably with some 
> set of rules - could I use it on 'Hamlet'?" I suppose the answer to 
> the second question has got to be "Yes" provided the range of syntax 
> and punctuation of the two plays is broadly the same (**exactly** the 
> same?). Still looking for that type of guidance - tho of course 
> strictly this is OT to RunRev: for which I crave your indulgence, my 
> Lords.

I found the XML ready-made on the web. Most likely it was written by 
hand someone typing in the XML markup, or using an XML editor to type 
it in.

If not, if it was actually parsed from some other format into XML, 
undoubtedly regular expressions were used. Something like

repeat for each line tLine of Macbeth
  if matchText(tLine, "Speaker:(.+)$", tSpeaker)
    revAddXMLNode(tDocID, tParent, "speaker", tSpeaker)
  end if
  -- etc for speech, stagedir, etc, etc.
end repeat


Alex Rice <alex at mindlube.com> | Mindlube Software | 
<http://mindlube.com>

what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco



More information about the use-livecode mailing list