5

So for example, if I wanted to declare &#hiragana_a; as an entity that corresponds to あ.

Is this possible in HTML?

The list of named entities for HTML5 can be found here.

This is possible using XML with a custom DTD.

So what if I used XHTML5? Could I specify a custom DTD with custom named entities?

Brandon
  • 259
  • 1
  • 3
  • 12
  • It is; however, possible with XML, as shown in the answer to this question: http://stackoverflow.com/questions/6508860/how-do-i-define-html-entity-references-inside-a-valid-xml-document So why not HTML? – Brandon Apr 05 '15 at 18:00

1 Answers1

5

So I figured out how to it, it required using XHTML.

Here's an example:

<!DOCTYPE html [
    <!ENTITY test "It worked">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="UTF-8"/>
        <title>HTML Entities</title>
    </head>
    <body>
        <span>&test;</span>
    </body>
</html>

This worked when I tested it using Google Chrome.

Brandon
  • 259
  • 1
  • 3
  • 12
  • Great idea! I wish that were the standard semantics. But I've tried it in an android webview; and it didn't work. Even with the doctype fragment and the xml ns declaration you suggest, android studio flagged an "undefined entity", and the runtime ignored my definition. – Papa Smurf Jun 15 '19 at 19:01