Rabin Halder
Rabin Halder

Reputation: 285

Explanation of MathML DTD Syntax

I was reading the MathML DTD. I came across a line of code. Below is the line of code.

<!ENTITY % mathml-qname.module "INCLUDE">
<![%mathml-qname.module; [<!ENTITY % mathml-qname.mod PUBLIC "-//W3C//ENTITIES    MathML   3.0 Qualified Names 1.0//EN" "mathml3-qname.mod"> %mathml-qname.mod;]]>

I could not understand the above two line. Can anybody explain the syntax?

Upvotes: 1

Views: 174

Answers (2)

C. M. Sperberg-McQueen
C. M. Sperberg-McQueen

Reputation: 25054

The first line declares a parameter entity named mathml-qname.module with the value "INCLUDE".

<!ENTITY % mathml-qname.module "INCLUDE">

The next bit I'm going to break up into several lines.

<![%mathml-qname.module; [
<!ENTITY % mathml-qname.mod PUBLIC 
  "-//W3C//ENTITIES    MathML   3.0 Qualified Names 1.0//EN" 
  "mathml3-qname.mod"> 
  %mathml-qname.mod;
]]>

The first and last lines (<![%mathml-qname.module;[ ... ]]>) are a conditional section -- that is, a section which may be read and processed normally, or skipped, depending on the value of its keyword. The keyword appears between the two left square brackets -- here, it's given by a reference to the parameter entity mathml-qname.module. If we expand the parameter entity reference, the conditional section looks like this:

<![INCLUDE [
 ...
]]>

As you might guess, the meaning of the keyword INCLUDE is: include, read, and process this section. (The other possible value is IGNORE.)

Within the marked section there is another parameter entity declaration, for a parameter entity named mathml-qname.mod. The PUBLIC keyword gives a public and a system identifier for the entity; to make a long story short, the entity in question is a collection of entities for MathML 3.0 qualified names, and it's located at the resource whose relative URI (relative to the resource containing this parameter entity declaration) is mathml3-qname.mod.

Following the parameter entity declaration for mathml-qname.mod, there is a reference to the same parameter entity (%mathml-qname.mod;), which causes the entity to be read and processed.

In informal terms: this block of code specifies that by default, the external resource mathml3-qname.mod should be consulted. But the user can override that default by including a parameter entity declaration of the following form at an appropriate location in their configuration:

<!ENTITY % mathml-qname.module "IGNORE">

You might do that if you had a different set of declarations for the qualified name entities of MathML 3.0.

Upvotes: 1

Daniel Haley
Daniel Haley

Reputation: 52888

This line:

<!ENTITY % mathml-qname.module "INCLUDE">

is a parameter entity. (A parameter entity can only be used in a DTD.) The value of the entity is "INCLUDE".

This line:

<![%mathml-qname.module; [<!ENTITY % mathml-qname.mod PUBLIC "-//W3C//ENTITIES    MathML   3.0 Qualified Names 1.0//EN" "mathml3-qname.mod"> %mathml-qname.mod;]]>

is another parameter entity that points to an external file with additional entity declarations. The difference is that it is wrapped in a conditional section. Basically is looks like this after mathml-qname.module is resolved:

<![INCLUDE [<!ENTITY % mathml-qname.mod PUBLIC "-//W3C//ENTITIES    MathML   3.0 Qualified Names 1.0//EN" "mathml3-qname.mod"> %mathml-qname.mod;]]>

This means the mathml-qname.mod declaration and reference will be included. If INCLUDE was changed to IGNORE in mathml-qname.module, the declaration and reference for mathml-qname.mod would be ignored.

Upvotes: 1

Related Questions