Class JavaScriptInXhtmlEncoder

  • All Implemented Interfaces:
    ValidMediaFilter, ValidMediaInput, ValidMediaOutput, Encoder

    public final class JavaScriptInXhtmlEncoder
    extends MediaEncoder

    Encode JavaScript and related formats into XHTML. The static utility methods only encode the characters. When used as a MediaWriter, it automatically adds the <script> tags and optionally a CDATA block.

    The CDATA block is not added for JSON and LD_JSON, because JSON does not support comments (insert Captain Picard facepalm pic here). However, as the JSON format will only contain <, >, or & within quoted strings, and those characters are unicode escaped, this should not present a compatibility issue between HTML and XHTML.

    Author:
    AO Industries, Inc.