Skip to content Skip to sidebar Skip to footer

How To Include Html Entities Into An Xml File

In firefox : ρ re

Solution 1:

Add the MathML 2.0 doctype, after the XML declaration:

<?xml version="1.0" encoding="utf-8"?><!DOCTYPE mathPUBLIC"-//W3C//DTD MathML 2.0//EN""http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"
>

The reason is that handling of entity references is very kludgy in web browsers. They do not actually read DTDs. Instead, they have built-in tables of predefined entities, which can be turned on by using specific doctype strings. This is string magic, and e.g. using MathML 3.0 doctype will not work. Cf. to XML to XHTML using XSLT: using entities such as &Sum; (which is a MATHML entity) (especially Martin Honnen’s comment on an answer).

Alternatively, use characters as such or, if your authoring system cannot produce them conveniently, character references like &#x3c1;.

Solution 2:

If you can modify the the XML to include an inline DTD you can define the entities there:

> <!DOCTYPE yourRootElement [
>     <!ENTITY bull"&#8226;">
>     .... ]>

Solution 3:

Note the definitions in XHTML1 and MathML2 are now obsolete and not aligned with the definitions that are built in to HTML parsers in current browsers. The current definitions as used in MathML3 and HTML5 are defined here

http://www.w3.org/2003/entities/2007doc/Overview.html

which is the editors (my:-) draft, with a link at the top to the REC version.

A single file set of DTD declarations for the entities is

http://www.w3.org/2003/entities/2007/htmlmathml-f.ent

generally speaking it is better to use numeric references rather than the named entities in an XML context as browsers will not fetch the externally referenced DTD.

Browsers following the HTML(5) spec will use a built in set of definitions derived from the above spec if you refer to the xhtml or mathml2 dtd via the public identifiers (ie they do not use the entity definitions that you specify).

see related bug against the HTML spec

https://www.w3.org/Bugs/Public/show_bug.cgi?id=13409

Post a Comment for "How To Include Html Entities Into An Xml File"