class type namespace_scope =The recursive class typeobject
..end
namespace_scope
represents the original
namespace declarations found in the XML text. A single namespace_scope
object contains a list of declared namespaces
[ (dp1, uri1); (dp2; uri2); ... ]
corresponding to the "xmlns"-type declarations found in a single
XML element:
<element xmlns:dp1="uri1" xmlns:dp2="uri2" ... >
For the declaration of a default namespace xmlns="uri"
the pair
("",uri)
must be included in the list. The special pair ("","")
means that the former default namespace is "undeclared".
Furthermore, the namespace_scope
object may have a parent
namespace_scope
, representing the namespace declarations in the
surrounding XML text. namespace_scope
objects are intentionally
immutable. When some XML subtree is cut out of a document
and inserted into another document, the original namespace_scope
declarations (including
all parents) are still applied to the subtree when it is in the
new document. Further changes in the old document cannot break this
assertion because of the immutability.
The namespace_scope
objects are connected with the namespace_manager
to allow translations from the namespace prefixes found in the XML
text (also called "display prefixes" from now on) to the normalized
prefixes stored in the namespace_manager
, and vice versa.
Call Pxp_dtd.create_namespace_scope
to create a scope object using
the default implementation.
See Intro_namespaces
for an introduction to namespaces and more
links to other explanations about scopes.
method namespace_manager : namespace_manager
namespace_manager
to which this scope object is
connectedmethod parent_scope : namespace_scope option
method declaration : (string * string) list
(display_prefix, uri)
.method effective_declaration : (string * string) list
(display_prefix, uri)
.
Prefixes hidden by earlier declarations are suppressed in the listmethod display_prefix_of_uri : string -> string
Namespace_not_in_scope
when the declaration cannot be found.method display_prefix_of_normprefix : string -> string
Namespace_not_in_scope
when the declaration cannot be found, and
Namespace_prefix_not_managed
when the
normalized prefix is unknown to the namespace manager.method uri_of_display_prefix : string -> string
Not_found
when the declaration cannot be found.method normprefix_of_display_prefix : string -> string
Not_found
when the declaration cannot be found, and
Namespace_not_managed
when the
namespace manager does not know the namespace.