<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="Up" href="Pxp_dtd.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Pxp_types" rel="Chapter" href="Pxp_types.html"> <link title="Pxp_document" rel="Chapter" href="Pxp_document.html"> <link title="Pxp_dtd" rel="Chapter" href="Pxp_dtd.html"> <link title="Pxp_tree_parser" rel="Chapter" href="Pxp_tree_parser.html"> <link title="Pxp_core_types" rel="Chapter" href="Pxp_core_types.html"> <link title="Pxp_ev_parser" rel="Chapter" href="Pxp_ev_parser.html"> <link title="Pxp_event" rel="Chapter" href="Pxp_event.html"> <link title="Pxp_dtd_parser" rel="Chapter" href="Pxp_dtd_parser.html"> <link title="Pxp_codewriter" rel="Chapter" href="Pxp_codewriter.html"> <link title="Pxp_marshal" rel="Chapter" href="Pxp_marshal.html"> <link title="Pxp_yacc" rel="Chapter" href="Pxp_yacc.html"> <link title="Pxp_reader" rel="Chapter" href="Pxp_reader.html"> <link title="Intro_trees" rel="Chapter" href="Intro_trees.html"> <link title="Intro_extensions" rel="Chapter" href="Intro_extensions.html"> <link title="Intro_namespaces" rel="Chapter" href="Intro_namespaces.html"> <link title="Intro_events" rel="Chapter" href="Intro_events.html"> <link title="Intro_resolution" rel="Chapter" href="Intro_resolution.html"> <link title="Intro_getting_started" rel="Chapter" href="Intro_getting_started.html"> <link title="Intro_advanced" rel="Chapter" href="Intro_advanced.html"> <link title="Intro_preprocessor" rel="Chapter" href="Intro_preprocessor.html"> <link title="Example_readme" rel="Chapter" href="Example_readme.html"><title>PXP Reference : Pxp_dtd.namespace_scope</title> </head> <body> <div class="navbar"> <a href="Pxp_dtd.html">Up</a> </div> <center><h1>Class type <a href="type_Pxp_dtd.namespace_scope.html">Pxp_dtd.namespace_scope</a></h1></center> <br> <pre><span class="keyword">class type</span> <a name="TYPEnamespace_scope"></a>namespace_scope = <code class="code"><span class="keyword">object</span></code> <a href="Pxp_dtd.namespace_scope.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>The recursive class type <code class="code">namespace_scope</code> represents the original namespace declarations found in the XML text. A single <code class="code">namespace_scope</code> object contains a list of declared namespaces <pre></pre><code class="code"> [ (dp1, uri1); (dp2; uri2); ... ] </code><pre></pre> corresponding to the "xmlns"-type declarations found in a single XML element: <pre></pre><code class="code"> <element xmlns:dp1=<span class="string">"uri1"</span> xmlns:dp2=<span class="string">"uri2"</span> ... > </code><pre></pre> For the declaration of a default namespace <code class="code">xmlns=<span class="string">"uri"</span></code> the pair <code class="code">(<span class="string">""</span>,uri)</code> must be included in the list. The special pair <code class="code">(<span class="string">""</span>,<span class="string">""</span>)</code> means that the former default namespace is "undeclared". <p> Furthermore, the <code class="code">namespace_scope</code> object may have a parent <code class="code">namespace_scope</code>, representing the namespace declarations in the surrounding XML text. <code class="code">namespace_scope</code> objects are intentionally immutable. When some XML subtree is cut out of a document and inserted into another document, the original <code class="code">namespace_scope</code> 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. <p> The <code class="code">namespace_scope</code> objects are connected with the <code class="code">namespace_manager</code> 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 <code class="code">namespace_manager</code>, and vice versa. <p> Call <a href="Pxp_dtd.html#VALcreate_namespace_scope"><code class="code"><span class="constructor">Pxp_dtd</span>.create_namespace_scope</code></a> to create a scope object using the default implementation. <p> See <a href="Intro_namespaces.html"><code class="code"><span class="constructor">Intro_namespaces</span></code></a> for an introduction to namespaces and more links to other explanations about scopes.<br> <hr width="100%"> <pre><span class="keyword">method</span> <a name="METHODnamespace_manager"></a>namespace_manager : <code class="type"><a href="Pxp_dtd.namespace_manager.html">namespace_manager</a></code></pre><div class="info"> Returns the <code class="code">namespace_manager</code> to which this scope object is connected<br> </div> <pre><span class="keyword">method</span> <a name="METHODparent_scope"></a>parent_scope : <code class="type"><a href="Pxp_dtd.namespace_scope.html">namespace_scope</a> option</code></pre><div class="info"> Returns the parent object, if any<br> </div> <pre><span class="keyword">method</span> <a name="METHODdeclaration"></a>declaration : <code class="type">(string * string) list</code></pre><div class="info"> Returns the list of namespace declarations of this scope (i.e. the declarations in parent objects are not considered). The list contains pairs <code class="code"> (display_prefix, uri) </code>.<br> </div> <pre><span class="keyword">method</span> <a name="METHODeffective_declaration"></a>effective_declaration : <code class="type">(string * string) list</code></pre><div class="info"> Returns the list of namespace declarations of this scope and all parent scopes. The list contains pairs <code class="code"> (display_prefix, uri) </code>. Prefixes hidden by earlier declarations are suppressed in the list<br> </div> <pre><span class="keyword">method</span> <a name="METHODdisplay_prefix_of_uri"></a>display_prefix_of_uri : <code class="type">string -> string</code></pre><div class="info"> Translates the URI to the corresponding display prefix as declared in this object or any parent object. Raises <code class="code"><span class="constructor">Namespace_not_in_scope</span></code> when the declaration cannot be found.<br> </div> <pre><span class="keyword">method</span> <a name="METHODdisplay_prefix_of_normprefix"></a>display_prefix_of_normprefix : <code class="type">string -> string</code></pre><div class="info"> Translates the normalized prefix to the corresponding display prefix as declared in this object or any parent object. Raises <code class="code"><span class="constructor">Namespace_not_in_scope</span></code> when the declaration cannot be found, and <code class="code"><span class="constructor">Namespace_prefix_not_managed</span></code> when the normalized prefix is unknown to the namespace manager.<br> </div> <pre><span class="keyword">method</span> <a name="METHODuri_of_display_prefix"></a>uri_of_display_prefix : <code class="type">string -> string</code></pre><div class="info"> Translates the display prefix to the corresponding URI as declared in this object or any parent object. Raises <code class="code"><span class="constructor">Not_found</span></code> when the declaration cannot be found.<br> </div> <pre><span class="keyword">method</span> <a name="METHODnormprefix_of_display_prefix"></a>normprefix_of_display_prefix : <code class="type">string -> string</code></pre><div class="info"> Translates the display prefix to the corresponding normalized prefix as declared in this object or any parent object. Raises <code class="code"><span class="constructor">Not_found</span></code> when the declaration cannot be found, and <code class="code"><span class="constructor">Namespace_not_managed</span></code> when the namespace manager does not know the namespace.<br> </div> </body></html>