[OT] Re: XML Tutorial

Graham Samuel graham.samuel at wanadoo.fr
Tue Jan 13 15:21:21 EST 2004


On Tue, 13 Jan 2004 09:29:01 -0700,Alex Rice <alex at mindlube.com> wrote:


>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

Sorry, this really has got OT now, so I'll shut up after this, but I'm 
still looking to make sense of a phrase like "typing in the XML markup". 
I'm feeling my way to the idea that XML is a bit like HTML (or even SGML if 
I knew what that was), which allows you to represent a structured text (or 
maybe something other than a text) using a restricted character set via a 
system of tags. Maybe the trick with XML is that you have meta-tags, as 
with Humpty Dumpty - " 'When I use a word', Humpty Dumpty said in a rather 
scornful tone, 'it means what I choose it to mean - neither more nor less'. "
If this is the case, I see that I can invent a structure for representing a 
Shakespeare play, but of course I can only **use** a populated structure of 
this kind if I understand the tags, so somehow the 'meaning' must be 
contained within the text. Muddling. I will search the Internet some more, 
next time I have a moment.

Graham


---------------------------------------------------
Graham Samuel / The Living Fossil Co. / UK & France  




More information about the use-livecode mailing list