W3C home > Mailing lists > Public > www-math@w3.org > September 2004

Re: Questions about MathML...

From: Robert Miner <RobertM@dessci.com>
Date: Thu, 23 Sep 2004 16:19:17 -0500
Message-Id: <200409232119.i8NLJH329985@wisdom.geomtech.com>
To: gmobug@gmobug.twbbs.org
CC: www-math@w3.org


Hi.

> Hello,

> I want to use MathML in dynamic page (php).  At the head of my php
> page, I header("Content-type:text/xml"); I don't know whether what I
> have done is right or not, but it can work well in some simple test.
> 
> But.....  When there are some special strings like "&plusmn;",
> "&minus;", the page cannot pass the xml regular.  Another similar
> problem, I can't use &nbsp; in the page.

The issue here is that the browser's XML parser needs the definitions
of these entity names in order to process them.  One accomplishes that
by including a DOCTYPE declaration at the beginning of your XHTML page
that references a DTD.  For example:

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
           "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"
>

or if you put a local copy of the DTD on your server

<!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
               "../xhtml-math11-f.dtd"
>

See   http://www.w3.org/TR/2003/REC-MathML2-20031021/appendixa.html
for more details on DTDs and doctypes.

> I have some javascript in the page, it can't pass the xml regular,
> either.
> 
> How to solve them?

Usually, this is just a result of special characters like '<' and '&'
in the JavaScript code needing to be escaped.  Note, however, that
there are some difference between the DOM for and XML document and an
HTML document, so depending on what you are trying to do, you may
actually need to modify your code.

--Robert

------------------------------------------------------------------
Dr. Robert Miner                                RobertM@dessci.com
W3C Math Interest Group Co-Chair                      651-223-2883
Design Science, Inc.   "How Science Communicates"   www.dessci.com
------------------------------------------------------------------
Received on Thursday, 23 September 2004 21:20:01 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:40 UTC