XHTML validation

17 Feb 20222 minutes to read

The editor provides an option to validate the source content of the Rich Text Editor against the XHTML standard using the ’enableXhtml’ property. When you enter or modify content in the editor, it continuously checks the XHTML source content and removes elements and attributes that are not valid.

The editor checks the following settings on validation:

Attributes

  • Must be specified in lowercase.
  • Proper use of quotation marks around the attributes.
  • Must be valid attributes for corresponding HTML element.
  • All the required attributes must be included in the HTML element.

HTML Elements

  • Must be in lowercase.
  • All opening tags must be closed.
  • Allows only the valid HTML elements.
  • Elements must be properly nested.
  • All elements must have one root element.
  • Should not use inline elements inside the block elements.
<div class="control-section">
   <ejs-richtexteditor enableXhtml="true">
    <e-content-template>
        <p>
            The Rich Text Editor control is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content.
            Users can format their content using standard toolbar commands.
        </p>
        <p><b> Key features:</b></p>
        <ul>
            <li><p> Provides &lt; IFRAME &gt; and &lt; DIV &gt; modes </p></li>
            <li><p> Capable of handling markdown editing.</p></li>
            <li><p> Contains a modular library to load the necessary functionality on demand.</p></li>
            <li><p> Provides a fully customizable toolbar.</p></li>
            <li><p> Provides HTML view to edit the source directly for developers.</p></li>
            <li><p> Supports third - party library integration.</p></li>
            <li><p> Allows preview of modified content before saving it.</p></li>
            <li><p> Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p></li>
            <li><p> Contains undo / redo manager.</p></li>
            <li><p> Creates bulleted and numbered lists.</p></li>
        </ul>
    </e-content-template>
</ejs-richtexteditor>
</div>
public class HomeController : Controller
{

    public ActionResult Index()
    {
        return View();
    }
}