Skip to main content

ASPxHtmlEditor.CorrectHtml(String, HtmlEditorHtmlEditingSettings) Method

Validates and corrects the passed HTML code based upon the settings specified.

Namespace: DevExpress.Web.ASPxHtmlEditor

Assembly: DevExpress.Web.ASPxHtmlEditor.v24.2.dll

Declaration

public static string CorrectHtml(
    string html,
    HtmlEditorHtmlEditingSettings settings
)

Parameters

Name Type Description
html String

A string value that specifies the HTML code to process.

settings HtmlEditorHtmlEditingSettings

An HtmlEditorHtmlEditingSettings object providing validation settings.

Returns

Type Description
String

A string value that is the resulting validated HTML code.

Remarks

Use the CorrectHtml method to process any required HTML code to make it valid, safe and compliant with the specified document type (via the HtmlEditorHtmlEditingSettings.AllowedDocumentType property): XHTML 1.0 Transitional, HTML5, or both. The resulting HTML code is always kept safe, since the method removes all potentially harmful code - unknown tags and attributes, script elements, client-side event handlers and URLs with script content. Automatic validation also helps to maintain the HTML code validity by correcting invalid tag hierarchies and changing invalid attribute values.

To learn more, see the HTML Validation topic.

See Also