Am 29.08.2006 um 13:26 schrieb Hamish Lawson:
> Christian Boos wrote:
>> [HTML entities are] supported, simply use the appropriate doctype.
> Of course. I was blinded to that by the fact that this declaration
> doesn't have any effect in Kid (I believe because ElementTree ignores
> it) - support for HTML entities had to be specially added to Kid.
Kid uses a custom Expat-based parser, so ElementTree isn't involved
in that step of the process. In fact, the Markup XMLParser is very
similar to that in Kid, which in turn is very similar to the parser
in ElementTree. But they all have their own implementation :-P
Anyway, the Kid parser instructs Expat to let it handle entity
references itself, so that Expat basically ignores the DTD. The Kid
parser then looks up any entity in a table of HTML entity definitions
(using the Python module "htmlentitydefs").
I've just changed the Markup XMLParser to do the same thing:
meaning that you can now use HTML entities in your Markup templates
without having to declare the DTD.
I should probably add a way to override this behavior, but at least
for templates I think it makes a lot of sense.
Feedback on this change welcome, as always ;-)
cmlenz at gmx.de