Write a term as created by the SGML/XML parser to a stream in
SGML or XML format. Options:
- cleanns(Bool)
- If
true
(default), remove duplicate xmlns
attributes.
- dtd(DTD)
- The DTD. This is needed for SGML documents that contain
elements with content model EMPTY. Characters which may
not be written directly in the Stream's encoding will be
written using character data entities from the DTD if at
all possible, otherwise as numeric character references.
Note that the DTD will NOT be written out at all; as yet
there is no way to write out an internal subset, though
it would not be hard to add one.
- doctype(DocType)
- Document type for the SGML document type declaration.
If omitted it is taken from the root element. There is
never any point in having this be disagree with the
root element. A <!DOCTYPE> declaration will be written
if and only if at least one of
doctype(_)
, public(_)
, or
system(_)
is provided in Options.
- public PubId
- The public identifier to be written in the <!DOCTYPE> line.
- system(SysId)
- The system identifier to be written in the <!DOCTYPE> line.
- header(Bool)
- If Bool is 'false', do not emit the <xml ...> header
line. (xml_write/3 only)
- nsmap(Map:list(Id=URI))
- When emitting embedded XML, assume these namespaces
are already defined from the environment. (xml_write/3
only).
- indent(Indent)
- Indentation of the document (for embedding)
- layout(Bool)
- Emit/do not emit layout characters to make output
readable.
- net(Bool)
- Use/do not use Null End Tags.
For XML, this applies only to empty elements, so you get
<foo/> (default, net(true))
<foo></foo> (net(false))
For SGML, this applies to empty elements, so you get
<foo> (if foo is declared to be EMPTY in the DTD)
<foo></foo> (default, net(false))
<foo// (net(true))
and also to elements with character content not containing /
<b>xxx</b> (default, net(false))
<b/xxx/ (net(true)).
Note that if the stream is UTF-8, the system will write special
characters as UTF-8 sequences, while if it is ISO Latin-1 it
will use (character) entities if there is a DTD that provides
them, otherwise it will use numeric character references.