The
code
element is intended for general instances of code as found in works of fiction and similar non-technical documents, which
includes computer programming code, commands and command input/output as well as representations of numeric and text coding
systems, such as Morse code.
For computer programming books, manuals and specifications, specializing the
code
element or using a computer markup feature is recommended.
Usage Example
<code>
<lngroup>
<ln>public static void helloWorld() {</ln>
<ln> Console.Write("Hello World!");</ln>
<ln>}</ln>
</lngroup>
</code>
Allowed parents
address,
annotation,
m:annotation-xml,
aside (block variant),
aside (toc variant),
backcover,
block,
caption,
description,
entry (bibliography variant),
entry (glossary variant),
flaps,
frontcover,
item,
d:longdesc,
note (block variant),
note (phrase variant),
object,
sel:otherwise,
quote,
section,
d:simplifiedLanguageDescription,
d:summary,
td,
th,
d:tour and
sel:when
Allowed children
This element must not contain text.
This element may contain the following children: block,
hd,
ln,
lngroup,
object,
p,
pagebreak and
transition
Content model and additional requirements
optional attributes:
@about,
@by,
@class,
@content,
@continuation,
@datatype,
@desc,
@its:dir,
@its:translate,
@property,
@rel,
@resource,
@rev,
@role,
@sel:selid,
@ssml:onlangfailure,
@typeof,
@xml:base,
@xml:id,
@xml:lang and
@xml:space
a choice of
end of choice
Note that in addition to restrictions presented in the content model above,
use of this element must also respect the following requirement:
- The
code
element must neither be empty nor contain only whitespace.
Such requirements take precedence over any conflicting statements in the
content model or in the lists above of allowed children and parents.
Variants
This element exists in 2 variants. The other variant is the phrase variant.
Namespace
http://www.daisy.org/ns/z3998/authoring/