how to validate user-generated html is well-formed?

Last post 02-18-2011, 11:10 AM by pw007. 3 replies.
Sort Posts: Previous Next
  •  02-11-2011, 4:47 PM 66176

    how to validate user-generated html is well-formed?

    I'm not talking about validating to w3 specs. I just want to ensure that the html that the user creates is 'well-formed' so that it doesn't screw up my 'host' page when it is displayed, because of missing closing tags, etc..
     
    Does anyone have any method to achieve this? Even an imperfect solution will be welcome (and better than nothing).
     
    Thanks.
    Filed under:
  •  02-11-2011, 7:52 PM 66177 in reply to 66176

    Re: how to validate user-generated html is well-formed?

    Hi pw007,
     
    By default, editor will close the tag directly.
     
    1. Please open http://www.cutesoft.net/example/general.aspx
     
    2. Clean the content and input the code below into HTML view
     
    <p>this is a test
     
    3. When you switch back to the Normal view, eidtor will close the <p> tag, like below
     
    <p>this is a test</p>
     
    Regards,
     
    Ken
  •  02-14-2011, 12:25 PM 66213 in reply to 66176

    Re: how to validate user-generated html is well-formed?

    pw007:
    I'm not talking about validating to w3 specs. I just want to ensure that the html that the user creates is 'well-formed' so that it doesn't screw up my 'host' page when it is displayed, because of missing closing tags, etc..
     
    Does anyone have any method to achieve this? Even an imperfect solution will be welcome (and better than nothing).
     
    Thanks.
     
    Please try this demo:
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  02-18-2011, 11:10 AM 66293 in reply to 66177

    Re: how to validate user-generated html is well-formed?

    Hi Ken - thanks for this. That behavior is definitely a start. But I wouldn't expect your product to be able to correct ALL invalid html (pretty impossible!).
    However, I would really like a way (either within your product or using some available code) to  just be able to validate that the html is well-formed. If a user creates poorly-formed html I will just reject it - otherwise his bad html could screw up my pages when displayed.
     
    Also - does your product itself always generate properly-formed html? (e.g. if the user doesn't manually edit the html).
     
    Thanks,
    Paul.
View as RSS news feed in XML