[XML-SIG] Embedding HTML in XML?

uche.ogbuji@fourthought.com uche.ogbuji@fourthought.com
Thu, 09 Sep 1999 11:05:49 -0400


> I am writing a Python application that uses XML for data storage.  I
> would like to allow HTML (or a subset thereof) to be used in notes,
> e.g.:
> <object id=1234>
>   <title>Parrot</title>
>   <note>
>     <b>bold</b>, etc.
>   </note>
> </object>
> 
> I currently use SAX for processing XML.  Is there a way to tell the
> parser to ignore everything until it reaches the </note> end tag, or do
> I have to rebuild the original text in my {start,end}Element handlers?

Have you considered using CDATA sections?

<object id=1234>
  <title>Parrot</title>
  <note>
    <![CDATA[<b>bold</b>, etc.]]>
  </note>
</object>

This way, your HTML will be preserved perfectly as a text node.  All XML 1.0 
processors should handle this for you.


-- 
Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji@fourthought.com	(970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com		http://OpenTechnology.org