In most cases, the preferred way to create an XML document is to
create a Prolog tree of element(Name, Attributes, Content)
terms and call xml_write/3
to write this to a stream. There are some exceptions where one might not
want to pay the price of the intermediate representation. For these
cases, this library contains building blocks for emitting markup data.
The quote funtions return a version of the input text into one that
contains entities for characters that need to be escaped. These are the
XML meta characters and the characters that cannot be expressed by the
document encoding. Therefore these predicates accept an encoding
argument. Accepted values are ascii
,
iso_latin_1
, utf8
and unicode
.
Versions with two arguments are provided for backward compatibility,
making the safe
ascii
encoding assumption.
<>&"
.4Older
versions also mapped ’
to '
.
Characters that cannot represented in Encoding are mapped to
XML character entities.ascii
encoding.ascii
encoding.ascii
encoding.