Section 3.14 Exceptional Characters
An advantage of XML syntax is that very few characters are reserved for the language’s use, and thus very few characters need to be escaped. Of course, there is always the need to escape the escape character.
The escape character for XML is the ampersand, &. The other dangerous character is the left angle bracket, the “less than,” <. If you like to be symmetric, you can also handle the right angle bracket, the “greater than,” >, similarly. Single and double quotation marks are used to delimit attributes, so are part of the XML specification, but do not present difficulties in narrative text.
These first two characters are interpreted by the XML processor very early in the analysis of your source. So they need to be authored specially via the XML entities
&
and <
. In practice, escaping >
is rarely necessary. So fundamentally within PreTeXt there are just two characters to type carefully or exceptionally.If you consistently follow the prescription in the previous paragraph you will avoid a descent into escape-character hell and avoid a lot of head-scratching. In particular, you should have no need of the
<![CDATA[
]]>
mechanism of XML, so please just forget we even mentioned it. But see Subsubsection 4.1.4.2 if you are curious, or want a more thorough discussion.