May 26, 2018

Convert XHTML+MathML Named Entities to Numeric Character References

MathMLEntities a content conversion filter for named XHTML+MathML entities. There are over two thousand named entities in the XHTML+MathML DTD. All the Entities defined in the XHTML+MathML DTD except the five “safe” ones <, >, &, ", ', will be converted to the equivalent numeric character references or to utf-8 characters. Named entities which are not in the XHTML+MathML DTD are escaped. This makes the resulting XHTML or XHTML+MathML safe for consumption by non-validating XML parsers.

Unlike, HTMLEntities, the mapping between MathML named entities and codepoints is many-to-one. Therefore, there’s no particular sense in having an inverse function, which takes codepoints to named entities.

Based on HTMLEntities by Koichi Taniguchi

WWW http//