[alicebot-archcomm] Whitespace clarification
Kim Sullivan
alicebot-archcomm@list.alicebot.org
Tue, 16 Sep 2003 00:53:28 +0200
> I'm not sure how current interpreters deal with this, and I'm
> also not sure
> about the whole concept of ignorable whitespace in the XML
> specification ..
> does the AIML spec imply that all ignorable whitespace is already stripped
> from the content before applying rules in section 2.10?
I'd say that the rules for whitespace handling in the spec are only trying
to explain what's in the XML standard in a more straightforward way, ie.
there are no additional whitespace handling rules in AIML (but I could be
mistaken).
> If I have the following category, will the predicate's string be
> " a test",
> " a test ", "a test ", or "a test"? And what would the template string be?
>
> <template>{newline}
> {tab}<set name="predicate">{newline}
> {tab}{tab}a test{newline}
> {tab}</set>{newline}
> </template>
"a test", both the variable and the resulting template. I have a feeling
that whitespace between elements doesn't count at all, only whitespace
between an element and element content, and only if it's separating content
(after the elements are processed). This would mean (if I'm correct) that
when you write
<template>{newline}
{tab}<set name="predicate">{newline}
{tab}{tab}a test{newline}
{tab}</set>{newline}
for whitespace{newline}
</template>
you'd get "a test" in the variable and "a test for whitespace" as the
output. I'll check it with the XML spec but I think I got it more or less
right - what it basically comes down to is that you have no whitespace
besides spaces, and only one consecutive space, and no whitespace at the
beginning or the end (works for both variables and templates as a whole).
Kim