[alicebot-archcomm] Attributes vs Elements
Andrew Teal
alicebot-archcomm@alice.sunlitsurf.com
Wed, 3 Jul 2002 10:23:11 +0100
Following up the General thread
RE: [alicebot-general] Condition help,
I remembered I had a similar problem when trying to compare 'variables':
<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!
It's our use of attributes rather than (nested) xml elements that causes(?)
these (and other?) problems.
<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!). 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?
The original example would be re-written
<category>
<pattern>I AM NOT *</pattern>
<template>
<think><set name="denyname"><formal><star/></formal></set></think>
<condition>
<li><name>denyname</name><value><get><name>name</name></get></value>You're
not?<srai>NOT MY NAME</srai></li>
<li>I suppose you're not.</li>
</condition>
</template>
</category>
Are the problems severe enough to justify proposing a change?
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Andrew Teal Information Technologist
School of Human & Health Sciences
HW1/05, University of Huddersfield,
Queensgate, Huddersfield, HD1 3DH
<a.teal@hud.ac.uk> Tel: 01484 473674
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-