About/Contact

Steve Trefethen

Steve Trefethen is a Director of Engineering at Reply. Contact me

View my LinkedIn profile


Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
$720 in referrals so far!


Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.



Why do we need to format html in Delphi?

March 31 2005 6:09PM

I know this issue has been pretty well discussed but someone recently asked me about it again and I put together a small example to help illustrate the problems that arise when using the MSHTML control and trying to preserve source code.

Here is what we hand the MSHTML control


  
    
  

  

        
  • one
        
  • two
      

  this is
wrapped text
  
    
      

  


we get this back (without editing anything btw):




  • one
  • two
this is wrapped text




Now, to point out the differences...

  1. All tags are now uppercase
  2. runat="server" on title tag is gone
  3. Missing the first closing (notice the last one is preserved)
  4. A single space was added between "two" and
  5. The wrapped text has been unwrapped
  6. The order of the table tag attributes has been reversed
  7. The quotes around the table tag attribues have been removed
  8. The case of the table tag attributes has been changed
  9. TBODY tag has been added
  10. A closing TR tag has been added (but no closing TD??)
  11. All whitespace has been removed (except of course where it was added see above)

So, as you can see when it comes to source preservation using the MSHTML control we definately have our work cut out for us thus we currently reformat the markup to make it readable again. I'll have more on this later.

FacebookDel.icio.usDigg It!

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading