[alicebot-archcomm] Whitespace clarification

Jonathan Roewen alicebot-archcomm@list.alicebot.org
Tue, 16 Sep 2003 11:06:31 +1200


> 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).

I'm pretty sure it's not the same as the XML specification. The XML
specification states that all whitespace must be passed to the application,
but it must also provide the ability to notify it of which whitespace is
considered ignorable. Which is where I've run into problems with the likes
of the libxml2 parser ;-)

> "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).

That's what I'd think too .. I also used xmllint to process some sample aiml
files, and get it to strip ignorable whitespace, and sometimes, tabs, and
less often, newlines are left in the output file, which would be contrary to
the AIML spec. I'll provide some sample files of what xmllint produces if
that would help.

> 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).

I wish this was what was happening ;-)

Jon