MSHTML, execCommand and well formed XML

S

Simon

Hi,

I have a webapp that allows an HTML description for an object to be
saved. It used to be pure text with no formatting. This caused
problems if the user entered (for example) and iframe tag, etc.. I
rewrote the input form to use MSHTML and updates a hidden input with
the inner HTML of the IFrame when the iframe generates an onblur
event. This keeps the hidden input from the user, but is submitted
when the form is submitted. This works, and I have even written some
HTML normalise script to ensure that all attribute values have double
quotes around them. However, sometime it generates badly formed HTML
when I re-edit the data, eg:
<UL>
<LI>TEST</LI>
<LI>sd</LI>
<LI>sd</LI></UL>

changes to :
<UL>
<LI><STRONG>TEST</STRONG>
<LI>sd
<LI>sd</LI></UL>

if I select Test in the browser and make it Bold. I lose the </LI>

Can I assign a DTD to validate the IFrame Document so that this does
not arise, alteratively can I set up the MSHTML control so that it
does not create badly formed HTML?

I am new to MSHTML, so please bear with me ;-)

Thanks,

Simon
 
M

Martin Honnen

Simon said:
Hi,

I have a webapp that allows an HTML description for an object to be
saved. It used to be pure text with no formatting. This caused
problems if the user entered (for example) and iframe tag, etc.. I
rewrote the input form to use MSHTML and updates a hidden input with
the inner HTML of the IFrame when the iframe generates an onblur
event. This keeps the hidden input from the user, but is submitted
when the form is submitted. This works, and I have even written some
HTML normalise script to ensure that all attribute values have double
quotes around them. However, sometime it generates badly formed HTML
when I re-edit the data, eg:
<UL>
<LI>TEST</LI>
<LI>sd</LI>
<LI>sd</LI></UL>

changes to :
<UL>
<LI><STRONG>TEST</STRONG>
<LI>sd
<LI>sd</LI></UL>

if I select Test in the browser and make it Bold. I lose the </LI>

The closing </li> is optional thus while you might not like that it is
omitted it is still correct markup.
 
C

Charles Banas

MSHTML is not an XHTML, or XML authoring tool, so of course it won't
produce valid XML.
no kidding. have you seen the output from FrontPage?

dear GOD.

i love standards compliance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top