Google News
logo
Jsoup - Interview Questions
What is the purpose of the 'Whitelist' class in Jsoup?
In Jsoup, the Whitelist class is used to specify which HTML elements and attributes are allowed when sanitizing HTML content. It serves as a configuration mechanism for controlling the sanitization process, ensuring that only safe and trusted elements and attributes are retained in the sanitized output while potentially harmful elements and attributes are removed.

The main purpose of the Whitelist class is to provide a customizable set of rules for filtering HTML content based on security and safety considerations, particularly to mitigate Cross-Site Scripting (XSS) attacks. By defining a whitelist of allowed elements and attributes, developers can enforce strict sanitization policies to prevent the execution of malicious scripts and protect against XSS vulnerabilities.
Advertisement