Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > d9c1887ff364dc87e282490223567c41 > files > 157

ocaml-pxp-1.2.1-1mdv2010.0.i586.rpm

<!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="next" href="Pxp_dtd.namespace_scope_impl.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_manager</title>
</head>
<body>
<div class="navbar">&nbsp;<a href="Pxp_dtd.html">Up</a>
&nbsp;<a href="Pxp_dtd.namespace_scope_impl.html">Next</a>
</div>
<center><h1>Class <a href="type_Pxp_dtd.namespace_manager.html">Pxp_dtd.namespace_manager</a></h1></center>
<br>
<pre><span class="keyword">class</span> <a name="TYPEnamespace_manager"></a>namespace_manager : <code class="type"></code><code class="code"><span class="keyword">object</span></code> <a href="Pxp_dtd.namespace_manager.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>This class manages mappings from URIs to normalized prefixes. For every
 namespace a namespace_manager object contains a set that maps
 various URI's to the same normalized prefix <code class="code">np</code>:
 <pre></pre><code class="code">&nbsp;uri1&nbsp;|-&gt;&nbsp;np,&nbsp;uri2&nbsp;|-&gt;&nbsp;np,&nbsp;...,&nbsp;uriN&nbsp;|-&gt;&nbsp;np&nbsp;</code><pre></pre>
 The normalized prefix <code class="code">np</code> is characterstical of the namespace, and
 identifies the namespace uniquely.
 The first URI <code class="code">uri1</code> is the primary URI, the other URIs are aliases.
<p>

 In order to create an empty namespace, call
 <a href="Pxp_dtd.html#VALcreate_namespace_manager"><code class="code"><span class="constructor">Pxp_dtd</span>.create_namespace_manager</code></a>.
<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 namespace managers.
<p>

 The following operations are supported:<ul>
<li><code class="code">add_namespace np uri</code>: adds a new mapping <code class="code">uri |-&gt; np</code> to the
   manager. Neither <code class="code">np</code> nor <code class="code">uri</code> must already be part of another
   mapping in the manager.</li>
<li><code class="code">add_uri np uri</code>: adds a new alias <code class="code">uri</code> for an existing namespace
   which is identified by the normprefix <code class="code">np</code>. The normprefix <code class="code">np</code>
   must already be part of a mapping which is then extended by this
   method.</li>
<li><code class="code">lookup_or_add_namespace p uri</code>: If there is already some mapping
   <code class="code">uri |-&gt; np</code>, the normprefix <code class="code">np</code> is simply returned ("lookup"). In this
   case <code class="code">p</code> is ignored. Otherwise <code class="code">uri</code> is not yet mapped, and in this
   case some unique <code class="code">np</code> must be found such that <code class="code">uri |-&gt; np</code> can be
   added (<code class="code">add_namespace</code>). First, the passed prefix <code class="code">p</code> is tried.
   If <code class="code">p</code> is free, it can be taken as new normprefix: <code class="code">np = p</code>. Otherwise
   some number <code class="code">n</code> is found such that the concatenation <code class="code">p ^ n</code> is free:
   <code class="code">np = p ^ n</code>. The operation returns <code class="code">np</code>.</li>
</ul>

 <b>Encodings:</b> prefixes and URIs are always encoded in the default
 encoding of the document<br>
<hr width="100%">
<pre><span class="keyword">method</span> <a name="METHODadd_namespace"></a>add_namespace : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">add_namespace np uri</code>: adds a new namespace to the object. The
 namespace is identified by the normprefix <code class="code">np</code> and contains initially
 the primary URI <code class="code">uri</code>.
 The method fails (<code class="code"><span class="constructor">Namespace_error</span></code>) if either <code class="code">np</code> already identifies
 some namespace or if <code class="code">uri</code> is already member of some namespace.
 Nothing happens if <code class="code">uri</code> is the sole member of the namespace <code class="code">np</code>.
 It is required that <code class="code">np &lt;&gt; <span class="string">""</span></code>.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODadd_uri"></a>add_uri : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">add_uri np uri</code>: adds <code class="code">uri</code> as alias URI to the namespace identified
 by the normprefix <code class="code">np</code> (see above for detailed semantics). The method
 raises <code class="code"><span class="constructor">Namespace_prefix_not_managed</span></code> if the normprefix <code class="code">np</code> is unknown
 to the object,
 and it fails (<code class="code"><span class="constructor">Namespace_error</span></code>) if the <code class="code">uri</code> is member of a
 different namespace. Nothing happens if the <code class="code">uri</code> is already member
 of the namespace <code class="code">np</code>.
<p>

 <b>Change in PXP 1.2:</b> Using exception <code class="code"><span class="constructor">Namespace_prefix_not_managed</span></code>
 instead of <code class="code"><span class="constructor">Not_found</span></code>.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODlookup_or_add_namespace"></a>lookup_or_add_namespace : <code class="type">string -> string -> string</code></pre><div class="info">
<code class="code">lookup_or_add_namespace p uri</code>: first, the method looks up if
 the namespace for <code class="code">uri</code> does already exist. If so, <code class="code">p</code> is ignored,
 and the method returns the normprefix identifying the namespace.
 Otherwise, a new namespace is added for some normprefix <code class="code">np</code> which
 initially contains <code class="code">uri</code>. The normprefix <code class="code">np</code> is calculated upon <code class="code">p</code>
 serving as suggestion for the normprefix. The method returns
 the normprefix.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODget_primary_uri"></a>get_primary_uri : <code class="type">string -> string</code></pre><div class="info">
Return the primary URI for a normprefix, or raises
 <code class="code"><span class="constructor">Namespace_prefix_not_managed</span></code>. <code class="code">get_uri <span class="string">""</span></code> raises always this
 exception.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODget_uri_list"></a>get_uri_list : <code class="type">string -> string list</code></pre><div class="info">
Return all URIs for a normprefix, or <code class="code">[]</code> if the normprefix is
 unused. <code class="code">get_uri_list <span class="string">""</span></code> returns always <code class="code">[]</code>. The last URI of the
 returned list is the primary URI.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODget_normprefix"></a>get_normprefix : <code class="type">string -> string</code></pre><div class="info">
Return the normprefix for a URI, or raises 
 <code class="code"><span class="constructor">Namespace_not_managed</span></code>.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODiter_namespaces"></a>iter_namespaces : <code class="type">(string -> unit) -> unit</code></pre><div class="info">
Iterates over all namespaces contained in the object, and
 calls the passed function for every namespace. The argument of the
 invoked function is the normprefix of the namespace.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODas_declaration"></a>as_declaration : <code class="type">(string * string) list</code></pre><div class="info">
Returns the list of normprefixes and primary URIs. Useful
 to create the corresponding namespace scope, e.g.
 <pre></pre><code class="code"><span class="keyword">new</span>&nbsp;namespace_scope_impl&nbsp;mng&nbsp;<span class="constructor">None</span>&nbsp;(mng<span class="keywordsign">#</span>as_declaration)&nbsp;</code><pre></pre><br>
</div>
</body></html>