classDocuments are used to represent closed documents that may consist of an XML declaration, a DTD, and a node tree.['a node #extension as 'a]document :?swarner:Pxp_types.symbolic_warnings -> Pxp_types.collect_warnings -> Pxp_types.rep_encoding ->object..end
Important invariant: A document is either empty (no root element, no DTD), or it has both a root element and a DTD.
A fresh document created by new is empty.
method init_xml_version : string -> unitmethod init_root : 'a node -> string -> unitinit_root checks whether the passed root element
has the type expected by the DTD. The check takes into account
that the root element might be a virtual root node.method xml_version : stringmethod xml_standalone : boolfalse if there is no DTD.method dtd : Pxp_dtd.dtdmethod encoding : Pxp_types.rep_encodingmethod root : 'a nodemethod raw_root_name : stringinit_root)method add_pinstr : Pxp_dtd.proc_instruction -> unitmethod pinstr : string -> Pxp_dtd.proc_instruction listmethod pinstr_names : string list
The write and display methods are very similar. The main difference
is how namespaces are handled. When generating XML text, the
namespaces need to be again represented as prefixes. The write
method uses the normalized prefixes for this purpose. The display
method uses the display prefixes, i.e. the prefixes as they orginally
have been in the parsed XML text. This means for parsed XML text
display produces an more exact copy of the text, whereas
write shows the prefixes as they are seen by the program.
method write : ?default:string ->
?prefer_dtd_reference:bool ->
?dtd_style:[ `Auto | `Included | `Omit | `Reference ] ->
?minimization:[ `AllEmpty | `DeclaredEmpty | `None ] ->
Pxp_types.output_stream -> Pxp_types.encoding -> unit
Option ~default: Specifies the normprefix that becomes the
default namespace in the output.
Option ~dtd_style: Selects how to print the DTD. `Omit means
to omit the DTD at all (no DOCTYPE clause).
`Reference prints the DTD reference to an
external entity (using SYSTEM or PUBLIC identifier), if possible,
and falls back to `Included otherwise. `Included means to
always include the DTD as internal subset. `Auto tries to find
the best way: If there is a DTD, try `Reference then `Included.
Otherwise, `Omit. The default is `Included.
Option ~prefer_dtd_reference: Same as ~dtd_style:`Reference
(backward-compatible).
Option ~minimization: How to write out empty elements. `AllEmpty
means that all empty elements are minimized (using the <name/>
form). `DeclaredEmpty minimizes only empty elements that are
declared as empty in the DTD. `None does not minimize at all
and is the default.
method display : ?prefer_dtd_reference:bool ->
?dtd_style:[ `Auto | `Included | `Omit | `Reference ] ->
?minimization:[ `AllEmpty | `DeclaredEmpty | `None ] ->
Pxp_types.output_stream -> Pxp_types.encoding -> unitwrite, this method uses the display namespace
prefixes instead of the normprefixes.
Option ~dtd_style: Same meaning as in write.
Option ~prefer_dtd_reference: Same meaning as in write.
Option ~minimization: Same meaning as in write.
method dump : Format.formatter -> unit