Summary: This module explains how to use XML namespaces and DTDs to combine multiple XML languages in the same document.
<table> tag in HTML and one
in a language describing office furniture as well. How do you
use these tags unambiguously, without losing functionality?
xmlns attribute to the value of the unique
identifier.
xmlns attribute. For example, you would
use the attribute
xmlns:foo="http://somewhere.org/foo" to
associate the prefix foo with the namespace
identifier http://somewhere.org/foo. You
can then indicate which tags come from that namespace by adding
the appropriate prefix to each tag. Thus, the
bar tag in foo's namespace would be written
as <foo:bar> and
</foo:bar>.
http://cnx.rice.edu/cnxml. Thus to
declare CNXML as the default namespace for a document, you would
add the attribute
to the
document tag. Similarly, the namespace
identifier for MathML is
http://www.w3.org/1998/Math/MathML, so to
associate the MathML namespace with the prefix
m, add the attribute
xmlns:m="http://www.w3.org/1998/Math/MathML"
to the document tag.
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5//EN"
"http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_plain.dtd">
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN"
"http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus QML//EN"
"http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_qml.dtd">
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus
MathML plus QML//EN"
"http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml_qml.dtd">
m prefix.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN"
"http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml"
xmlns:m="http://www.w3.org/1998/Math/MathML"
. . .>
<metadata xmlns:md="http://cnx.rice.edu/mdml/0.4">
<md:version>2.14</md:version>
<md:created>2001/06/29</md:created>
<md:revised>2004-04-19T19:09:52Z</md:revised>
<md:authorlist>
<md:author id="selc">
<md:firstname>Sarah</md:firstname>
<md:surname>Coppin</md:surname>
<md:email>coppin@alumni.rice.edu</md:email>
</md:author>
<md:author id="brentmh">
<md:firstname>Brent</md:firstname>
<md:othername>Michael</md:othername>
<md:surname>Hendricks</md:surname>
<md:email>brentmh@rice.edu</md:email>
</md:author>
</md:authorlist>
<md:maintainerlist>
<md:maintainer id="mizar">
<md:firstname>Christine</md:firstname>
<md:surname>Donica</md:surname>
<md:email>mizar@alumni.rice.edu</md:email>
</md:maintainer>
<md:maintainer id="selc">
<md:firstname>Sarah</md:firstname>
<md:surname>Coppin</md:surname>
<md:email>coppin@alumni.rice.edu</md:email>
</md:maintainer>
<md:maintainer id="jenn">
<md:firstname>Jenn</md:firstname>
<md:othername>A.</md:othername>
<md:surname>Drummond</md:surname>
<md:email>jenn@rice.edu</md:email>
</md:maintainer>
<md:maintainer id="brentmh">
<md:firstname>Brent</md:firstname>
<md:othername>Michael</md:othername>
<md:surname>Hendricks</md:surname>
<md:email>brentmh@rice.edu</md:email>
</md:maintainer>
</md:maintainerlist>
<md:keywordlist>
<md:keyword>XML</md:keyword>
<md:keyword>namespace</md:keyword>
<md:keyword>DTD</md:keyword>
<md:keyword>tutorial</md:keyword>
</md:keywordlist>
<md:abstract>This module explains how to use XML namespaces and DTDs to combine multiple XML languages in the same document.</md:abstract>
</metadata>
<content>
<para id='p1'>
This math says "3y".
<m:math display='inline'>
<m:apply>
<m:times/>
<m:cn>3</m:cn>
<m:ci>y</m:ci>
</m:apply>
</m:math>
</para>
</content>
</document>