HTML code inside answer

  • Fabrizio Cipriani

    Why the bot removes html code inside the answer? For example: <a href="">Click here</a> in the aiml file will be returned as "Click here" from the bot. Is there a way to include html code in the aiml base which will be return in the answer as well?

    Fabrizio Cipriani

    • Nicholas Tollervey


      It has been a few years since I wrote the code but I seem to remember security concerns and a lack of time were the main reasons for stripping out all XML other than AIML.

      Security concerns? Well, if my bot was going to be accessed via a web frontend (which the original one *was*) and we wanted it to store away input from the user (which we did) then we (the original company who allowed me to open-source the thing) decided we didn't want the possibility of javascript injection. But that was back in 2002, it was my first development job, and to be honest there are definitely more elegant ways to solve that problem.

      How to solve the problem? The line you need to change is in the bot.cs file at line 834. Basically, the bot attempts to match an XML element against an AIML tag and if it doesn't then tagHandler = null. The lines around 834 basically test for tagHandler=null and line 834 returns the InnerText of the unknown XML element. I suggest you change it to OuterText and that should do the trick.

      Hope that helps,



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks