Serious problems with bad HTML format

5 posts, 0 answers
  1. Brian Ho
    Brian Ho avatar
    12 posts
    Member since:
    Mar 2010

    Posted 14 Mar 2011 Link to this post

    Hi there,

    I've already mentioned in the previous thread about my problem: http://www.telerik.com/community/forums/aspnet-ajax/editor/formatting-within-conten.aspx.   But I thought I start a new thread as the problem has gone beyond Telerik editor randomly adding in spaces.   Basically I just converted my website from a very old version of CuteEditor to Telerik RadEditor.  There are thousands of documents in the database that were created by this old CuteEditor and have very very badly formatted HTML.   At first when I put in Telerik editor, the first symptoms were tables getting random spaces put into table cell everytime when the user is switching from design view to html view.   Weird syntax which I already described in my previous thread's comments.  So then I tried removing the ConvertToXHTML filter, seems to stop adding in pages and pages of space.  But then in other documents it was still adding in spaces in between list items and table cells.   I tried removing all filters except for IndentHTML filter and still I find the RadEditor is still trying to messing with the HTML somehow.   

    For example:

    Badly formatted HTML like this: 
    <p><a href="#17">17. Can you help me interpret and operationalize the nutrition standards
               of the food and beverage policy?
           </p>
           <p>
               </a><a href="#18">18. EXAMPLES</a>
           </p>

    is turning into this:

    <P><A href="#17">17. Can you help me interpret and operationalize the nutrition standards of the food and beverage policy? </A></P>
        </P>
        <P>
        <P>
        <DIV _rdEditor_temp="1"><A href="#17"></DIV>
        </A></P>
        <A href="#17"></A></P>
        <A href="#17">
        <P><A href="#18">18. EXAMPLES</A> </P>
        </A></A>
        <P></A></P>

    Is this a bug?  Also random </o:p> are getting inserted into the code.  I know that RadEditor requires xhtml compliant HTML to work well but I have thousands of documents in the database and my users do not know HTML.  Is there a solution you can recommend?  I looked at stuff like HTMLPurifier and I used the example above on their demo and it seems to clean the HTML quite well.   Problem is HTMLPurifier is a php product.  Does anyone have any experience with this or any suggestions?  Any help or tips at all would be greatly appreciated.

    Thanks.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5522 posts

    Posted 16 Mar 2011 Link to this post

    Hi Brian,

    In short - the answer would be "no, this is not a bug", as this is not the intender purpose of the RadEditor.

    The browser's Rich Text Editing engine checks for unclosed and non well formed tags and corrects or tries to correct them automatically without providing a way to disable the browser validation. This means that it is not always possible to validate non well formed HTML content.

    Please note that RadEditor is not an HTML validator or improvement tool (and neither is the ConvertToXhtml content filter), therefore you should set valid HTML content in it in order to get proper results.

    The best solution is, as was proposed in the other thread, to instruct the users to use a validator.
    Alternatively you could look into HTML repairing tools and fix the files in your database yourself. Unfortunately we cannot recommend third party software.


    Regards,
    Marin
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Rumen
    Admin
    Rumen avatar
    14361 posts

    Posted 16 Mar 2011 Link to this post

    This is a quick follow-up.

    I want to add that we are always doing our best to enhance the editor to produce valid XHTML content but this is not always possible when loading non well formed HTML content in it.
    When the ConvertToXhtml filter is disabled it is the Rich Text Editing engine of the browser that validates and modifies the content.
    In Q1 2011 we improve the editor and if you upgrade to the latest version the following div element

    <DIV _rdEditor_temp="1">...</DIV>

    will be not added to the content.

    We also plan to enhance the ConvertToXhtml filter to strip all additionally added <p> tags in the latest version of RadEditor, which should fix the reported spacing problem in between list items and table cells.

    Kind regards,
    Rumen
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  4. Mike
    Mike avatar
    1 posts
    Member since:
    Apr 2012

    Posted 17 Apr 2012 Link to this post

    Hi!
    We use new Telerik version 2012.1.215.35. But this problem don't resolve..
    When I load HTML from our template RadEditor add DIV tag before my TABLE tag:
    <DIV style="MARGIN: 0cm 0cm 0pt" _rdEditor_temp="1"><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 8pt"><o:p><FONT size=3>
    with additional spaces and new tags <P>&nbsp;</P> after TABLE.
    How can I avoid inserting this tag?
  5. Rumen
    Admin
    Rumen avatar
    14361 posts

    Posted 17 Apr 2012 Link to this post

    Hello,

    Are you able to reproduce the problem in the Built-in Content Filters demo of RadEditor? Just paste the template content in HTML mode of RadEditor and switch to Design and back to HTML mode to see how it is changed by the filters? After that disable the ConvertToXhtml filter and test again.

    If the problem is reproducible in the live demo: provide the original template HTML file and a Jing video demonstrating your test. If the problem appears in your project only, compare the configuration of RadEditor in the live demo with this one under your project.

    All the best,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top