Template parser patch

When using CDATA sections within a XHTML document the parser produces stack traces in the logfiles (document is completely and correctly parsed though). This patch tests for CDATA sections and prevents the stack trace.

Additionally the patch makes some memory optimizations to reduce the creation of string objects during parsing.