[XML-SIG] problem with elementtree 1.2.6

"Martin v. Löwis" martin at v.loewis.de
Fri Nov 30 09:05:23 CET 2007

>>      What is not in the Information Set
>>      6. Whether characters are represented by character references.
>>      19. The boundaries of CDATA marked sections.
>>      ...
> I'm not sure I follow what you're trying to say...

That it is irrelevant in XML whether the less-than character is
represented as &lt; or &#60; or <![CDATA[<]]>

So if some XML library choses to represent < as &lt; you should
not be surprised.

It's not clear to me (perhaps because I lack the starting of this
discussion) what the actual problem *is* that you are trying to

>>> I and many others do not ;-) When writing content into an html template, 
>>> that content often comes from other sources that spit out lumps of html. 
>>> Being able to insert them without escaping is a common use case.
>> HTML might be similar to XML, but an XML parser cannot parse HTML, so 
>> you cannot insert HTML fragments into an XML document without either
>> escaping it, or pre-processing it to make sure it's well-formed.
> What about xhtml?

It should be possible to insert XHTML fragments into XHTML documents,
in selected positions, assuming an appropriate definition of "to insert".

For ET (and any other tree-oriented XML implementation), replacing
text with serialized XHTML in the tree is not an appropriate
implementation of "to insert", as that will just insert less-than
characters, not markup. To insert markup (in particular, tags,
i.e. elements), you need to insert Element objects into the tree.


More information about the XML-SIG mailing list