Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

HTMLEscaper



The HTMLEscaper class allows to:
  • convert a text with HTML entities to be usable in XML
  • convert a text characters to their corresponding HTML entities

Convert a text with HTML entities to be usable in XML

The HTMLEscaper.escapeToXML(String) method allows to convert a text with HTML entities to be usable in XML. HTML entities are converted to the associated XML content.

For example:
  • The é or è text will be converted to The é or è text
The full HTMLEscaper.escapeToXML(String, boolean, boolean) method allow to:
  • Optionally don't escape ">" and "<" characters
  • Optionally don't escape in XML non ASCII characters

Convert a text with HTML entities to be usable in XML attributes

The HTMLEscaper.escapeXMLAttribute(String) method allows to use a text for XML attributes. It will:
  • Convert the "<" character to &lt;
  • Convert the ">" character to &gt;
  • Convert the "&" character to &amp;
  • Convert the quote character to &#39;
  • Convert the double quote character to &#34;
  • Convert the new line character to &#xA;. This conversion is very important because regular new line characters are discarded by XML parsers

Convert a text characters to their corresponding HTML entities

The HTMLEscaper.escapeToHTML(String) method allows to convert text characters to their corresponding HTML entities.

For example:
  • The &#x00E9; or &#x00E8; text will be converted to The &eacute; or &egrave; text

List of supported HTML entities

See the htmlEntities file for the list of supported HTML entities[1]
See the mateam.net/html-escape-characters page for the list of html escape characters
.

Notes

  1. ^ See the mateam.net/html-escape-characters page for the list of html escape characters

See also


Categories: lang | packages

Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences