Building a MemoryML document
Based on the structure we've defined, a simple file that uses the new elements and incorporates them into an XHTML page might look like this:
<?xml version="1.0"?>
<!DOCTYPE html SYSTEM "xhtml-memory-1.dtd">
<html>
<head><title>Sample Page</title></head>
<body>
<p><a href="newpage.mml"><subject>Pitching a tent</subject></a></p>
<ul>
<li><subject>Pitching a tent</subject></li>
<li><subject>Baseball game</subject></li>
</ul>
<video tapeid="A323">
<media mediaid="A323" type="VHS"/>
<start>0:00:00</start>
<end>32:12:45</end>
<subdate>2001-05-23</subdate>
<donor>John Baker</donor>
<subject>Pitching a tent</subject>
<location><description>Outside in the woods</description></location>
</video>
<audio tapeid="C531">
<media mediaid="C531" type="DAT"/>
<start>12:09:23</start>
<end>58:34:51</end>
<subdate>2001-05-18</subdate>
<donor>Elizabeth Davison</donor>
<subject>Baseball Game</subject>
</audio>
</body>
</html> |
Notice that the page uses the new DTD. In this case, no namespace information is provided because it's not necessary.
Some cases might require that namespace information be provided.
Because the internal DTD subset always takes precedence, it's easy to
use it to turn on prefixing. Remember %Memory.prefixed;? Turn it
on here and it overrides any other settings.
<?xml version="1.0"?>
<!DOCTYPE html SYSTEM "xhtml-memory-1.dtd"[
<!ENTITY % Memory.prefixed "INCLUDE">
<!ENTITY % Memory.prefix "mem">
]>
<html xmlns:mem="http://www.my.org/namespaces/MemoryML>
<head><title>Sample Page</title></head>
<body>
<p><a href="newpage.mml"><mem:subject>Pitching a tent</mem:subject></a></p>
<ul>
<li><mem:subject>Pitching a tent</mem:subject></li>
<li><mem:subject>Baseball game</mem:subject></li>
</ul>
<mem:video tapeid="A323">
<mem:media mediaid="A323" type="VHS"/>
<mem:start>0:00:00</mem:start>
<mem:end>32:12:45</mem:end>
<mem:subdate>2001-05-23</mem:subdate>
<mem:donor>John Baker</mem:donor>
<mem:subject>Pitching a tent</mem:subject>
<mem:location><mem:description>Outside in the woods</mem:description></mem:location>
</mem:video>
<mem:audio tapeid="C531">
<mem:media mediaid="C531" type="DAT"/>
<mem:start>12:09:23</mem:start>
<mem:end>58:34:51</mem:end>
<mem:subdate>2001-05-18</mem:subdate>
<mem:donor>Elizabeth Davison</mem:donor>
<mem:subject>Baseball Game</mem:subject>
</mem:audio>
</body>
</html> |
Notice also that the prefix in this file is different from the one specified in the original Qnames module. This is not a problem. Like the prefix switch, this value takes precedence over any others.
A similar method turns on all prefixing.
Turning on all prefixing is as simple as changing the default prefixing setting:
<?xml version="1.0"?>
<!DOCTYPE xhtml:html SYSTEM "xhtml-memory-1.dtd"[
<!ENTITY % NS.prefixed "INCLUDE">
<!ENTITY % XHTML.prefix "xhtml" >
<!ENTITY % Memory.prefix "mem">
]>
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:mem="http://www.my.org/namespaces/MemoryML">
<xhtml:head><xhtml:title>Sample Page</xhtml:title></xhtml:head>
<xhtml:body>
<xhtml:p>
<xhtml:a href="newpage.mml"><mem:subject>Pitching a tent</mem:subject></xhtml:a></xhtml:p>
<xhtml:ul>
<xhtml:li><mem:subject>Pitching a tent</mem:subject></xhtml:li>
<xhtml:li><mem:subject>Baseball game</mem:subject></xhtml:li>
</xhtml:ul>
<mem:video tapeid="A323">
<mem:media mediaid="A323" type="VHS"/>
<mem:start>0:00:00</mem:start>
<mem:end>32:12:45</mem:end>
<mem:subdate>2001-05-23</mem:subdate>
<mem:donor>John Baker</mem:donor>
<mem:subject>Pitching a tent</mem:subject>
<mem:location><mem:description>Outside in the woods</mem:description></mem:location>
</mem:video>
<mem:audio tapeid="C531">
<mem:media mediaid="C531" type="DAT"/>
<mem:start>12:09:23</mem:start>
<mem:end>58:34:51</mem:end>
<mem:subdate>2001-05-18</mem:subdate>
<mem:donor>Elizabeth Davison</mem:donor>
<mem:subject>Baseball Game</mem:subject>
</mem:audio>
</xhtml:body>
</xhtml:html> |
Notice also that because %Memory.prefixed; inherits the
value of %NS.prefixed; it does not need to be set separately.

