[alicebot-archcomm] Attributes vs Elements

Manos Batsis alicebot-archcomm@alice.sunlitsurf.com
Wed, 3 Jul 2002 12:39:31 +0300


> 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="&lt;star index='2'/&gt;"/>">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