[alicebot-archcomm] Attributes vs Elements
Dr. Richard S. Wallace
alicebot-archcomm@alice.sunlitsurf.com
Wed, 3 Jul 2002 06:22:48 -0700
It's enlightening to use the "Explore" feature on Pandorabots to check out
the way John Foderaro developed to store AIML templates as S-expressions in
Lisp, e.g.
(category (template (srai "WHAT IS XML")) (pattern "XML"))
In some sense XML is a horrible syntax, especially for lists. If you use
Lisp syntax, the <li></li> elements go away completely.
The downside is that you lose the "markup" aspect of XML. Strings have to
be quoted. Quotation marks have to be escaped.
In this context, it is intertesting to consider how various proposals for
attributes vs. elements map between XML notation and S-expression notation.
Perhaps the best choices are the ones that look nice in both forms.
I am fond of saying AIML is platform-independent and language-independent.
I wonder if it can be made syntax-independent too?
Rich
----- Original Message -----
From: "Manos Batsis" <m.batsis@bsnet.gr>
To: <A.Teal@hud.ac.uk>; <alicebot-archcomm@alice.sunlitsurf.com>
Sent: Wednesday, July 03, 2002 2:39 AM
Subject: RE: [alicebot-archcomm] Attributes vs Elements
>
> > From: Andrew Teal [mailto:A.Teal@hud.ac.uk]
>
> > <category>
> > <pattern>COMPAREVARIABLES * *</pattern>
> > <template>
> > <condition name="<star/>">
> > <li value="<get name="<star index="2"/>"/>">Same value!</li>
> > <li>Different values!</li>
> > </condition></template>
> > </category>
> >
> > Again that's logically what I want to do, but it's even 'more
> > illegal' :-)
> > than Christopher's example!
>
> Yes. It makes AIML difficult to handle. Even when we change the
> problematic line to
>
> <li value="<get name="<star index='2'/>"/>">Same value!</li>
>
> using entities and proper quoting, the AIML is still unfriendly to XML
> related technology; it's a matter of XML design. For example, I've been
> working on a DHTML based XML editor that uses XSLT to translate any XML
> to a grid (for visual editing). Any XSLT processor will replace the
> entities to what they represent, making the above AIML invalid.
>
>
> > <category>
> > <pattern>COMPAREVARIABLES * *</pattern>
> > <template>
> > <condition><name><star/></name>
> > <li><value><get><name><star index="2"/></name></get></value>Same
> > value!</li>
> > <li>Different values!</li>
> > </condition>
> > </template></category>
> >
> > ... would be fine (though the tag names may need
> > clarifying!).
>
> Agreed.
>
>
> > McLaughlin
> > says (Java & XML) "... a good rule of thumb: use elements for
> > multiple-valued data and attributes for single-valued data."
> > Does that apply
> > in these contexts?
>
> I would add that attributes are definitely not suitable for holding any
> "representation of markup" with the exception of QNames.
>
>
> > Are the problems severe enough to justify proposing a change?
>
> I would second such a proposal at once. If you need help with the
> details feel free to knock.
>
> Kindest regards,
>
> Manos
>
> _______________________________________________
> alicebot-archcomm mailing list
> alicebot-archcomm@alice.sunlitsurf.com
> http://alice.sunlitsurf.com/mailman/listinfo/alicebot-archcomm