We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Validation / Fixing of XHTML

Thread ID:





120648 Sep 30,2015 11:29 AM UTC Sep 30,2015 02:48 PM UTC ASP.NET MVC 1
Tags: DocIO
Asked On September 30, 2015 11:29 AM UTC


we are generating some word documents using DocIO and Mail Merge. The XHTML is coming from your RTE Element and stored in a database. Unforunately we have some older Entries there from the RTE when there was no EnableXHTML() Feature. This ist throwing some exceptions with invalid <br> or <img ...>, ...

We have tried many approaches to get this HTML fixed in MVC with many Packages, but there seems to be no up-to-date solution for this except developing some custom solution on our own. Is there some tool in your products to validate or even fix html strings before inserting them into the document?

king regards,

Sathish K [Syncfusion]
Replied On September 30, 2015 02:48 PM UTC

Hi Lc,

Thank you for contacting Syncfusion support.

Currently Essential DocIO supports, only XHTML 1.0 complaints for the HTML. We internally perform the XHTML 1.0 validation for the input HTML in DocIO and then process the document further. If the input HTML fails to meet the XHTML 1.0 complaints then exception will be thrown with respect the unsupported elements. You can check your input HTML in the following link to ensure whether it meets the XHTML 1.0 complaints or not.


You shall also use the below code to check whether the given HTML string is valid or not using DocIO.

Code example:
WordDocument doc = new WordDocument();           
bool isValidHtmlString = doc.LastSection.Body.IsValidXHTML(htmlString, XHTMLValidationType.Strict);

Please do not use “None” validation type for validating the HTML string in the above code. Kindly use “Strict” or “Transitional” validation types.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon