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
Most programming books start with a simple <code>helloWorld()</code> example.
Allowed parents
address,
annoref,
annotation (block variant),
annotation (phrase variant),
m:annotation-xml,
aside (block variant),
aside (toc variant),
block,
caption,
citation (block variant),
citation (phrase variant),
d,
definition,
description (block variant),
description (phrase variant),
emph,
entry (toc variant),
entry (index variant),
entry (bibliography variant),
entry (glossary variant),
expansion,
xforms:group,
h,
hd,
hpart,
item,
xforms:label,
ln,
d:longdesc,
meta,
note (block variant),
note (phrase variant),
noteref,
object (block variant),
object (phrase variant),
sel:otherwise,
p,
ssml:phoneme,
ssml:prosody,
quote (block variant),
quote (phrase variant),
its:rb,
ref,
xforms:repeat,
its:rt,
s,
ssml:say-as (phrase variant),
ssml:say-as (text variant),
d:simplifiedLanguageDescription,
span,
spine,
ssml:sub,
d:summary,
td,
term,
th,
d:tour and
sel:when
Allowed children
This element may contain text.
This element may contain the following children: ssml:break,
char,
emph,
object,
pagebreak,
ssml:phoneme,
ssml:prosody,
its:ruby,
ssml:say-as,
span,
sub,
ssml:sub,
sup and
ssml:token
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
one or more of
a choice of either one of the 14 elements:
char,
emph,
its:ruby,
object,
pagebreak,
span,
ssml:break,
ssml:phoneme,
ssml:prosody,
ssml:say-as,
ssml:sub,
ssml:token,
sub or
sup
or text
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 block variant.
Namespace
http://www.daisy.org/ns/z3998/authoring/