Sophie

Sophie

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

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="previous" href="Pxp_dtd.namespace_scope_impl.html">
<link rel="next" href="Pxp_dtd.dtd_element.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.dtd</title>
</head>
<body>
<div class="navbar"><a href="Pxp_dtd.namespace_scope_impl.html">Previous</a>
&nbsp;<a href="Pxp_dtd.html">Up</a>
&nbsp;<a href="Pxp_dtd.dtd_element.html">Next</a>
</div>
<center><h1>Class <a href="type_Pxp_dtd.dtd.html">Pxp_dtd.dtd</a></h1></center>
<br>
<pre><span class="keyword">class</span> <a name="TYPEdtd"></a>dtd : <code class="type">?swarner:Pxp_core_types.I.symbolic_warnings -> Pxp_core_types.I.collect_warnings -> Pxp_core_types.I.rep_encoding -> </code><code class="code"><span class="keyword">object</span></code> <a href="Pxp_dtd.dtd.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>DTD objects have two purposes:<ul>
<li>They are containers for global declarations that apply to the
         whole XML document. This includes the character set, the
         standalone declaration, and all declaration that can appear
         in the "DTD part" of a document.</li>
<li>Also, they express formal constraints the document must fulfill
         such as validity, or (less ambitious) well-formedness.</li>
</ul>

      Normally, programmers neither need to create such objects, nor to
      fill them with data, as the parser already does this. If it is required
      to create a DTD object, the recommended function is
      <a href="Pxp_dtd.html#VALcreate_dtd"><code class="code"><span class="constructor">Pxp_dtd</span>.create_dtd</code></a>.
<p>

      Despite its name, this object does not only define the DTD as
      such (i.e. what would be found in a ".dtd" file), but all formal
      requirements of documents that are needed by PXP. This also includes:<ul>
<li>The name of the root element</li>
<li>The character encoding of the document</li>
<li>Whether validation is on or off</li>
<li>The namespace manager</li>
<li>Whether the document is declared as standalone</li>
</ul>

      A consequence of this is that even documents have a DTD object
      that only have to comply to the relatively weak well-formedness
      constraints.
<p>

      For some introductory words about well-formedness mode, see
      <a href="Intro_getting_started.html#wfmode"><i>Parsing in well-formedness mode</i></a>.<br>
<hr width="100%">
<pre><span class="keyword">method</span> <a name="METHODroot"></a>root : <code class="type">string option</code></pre><div class="info">
get the name of the root element if present. This is the name
 following "&lt;!DOCTYPE". If there is no DOCTYPE declaration, 
 this method will return None.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODset_root"></a>set_root : <code class="type">string -> unit</code></pre><div class="info">
set the name of the root element. This method can be invoked 
 only once (usually by the parser)<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODid"></a>id : <code class="type">Pxp_core_types.I.dtd_id option</code></pre><div class="info">
get the identifier for this DTD. Possible return values:<ul>
<li><code class="code"><span class="constructor">None</span></code>: There is no DOCTYPE declaration, or only
    <code class="code">&lt;!<span class="constructor">DOCTYPE</span> name&gt;</code></li>
<li><code class="code"><span class="constructor">Some</span> <span class="constructor">Internal</span></code>: There is a DOCTYPE declaration with material
    in brackets like <code class="code"> &lt;!<span class="constructor">DOCTYPE</span> name [ declarations ... ]&gt; </code></li>
<li><code class="code"><span class="constructor">Some</span>(<span class="constructor">External</span> xid)</code>: There is a DOCTYPE declaration with
    a SYSTEM or PUBLIC identifier (described by <code class="code">xid</code>), but without
    brackets, i.e. <code class="code"> &lt;!<span class="constructor">DOCTYPE</span> name <span class="constructor">SYSTEM</span> <span class="keywordsign">'</span>...<span class="keywordsign">'</span>&gt; </code> or 
    <code class="code"> &lt;!<span class="constructor">DOCTYPE</span> name <span class="constructor">PUBLIC</span> <span class="keywordsign">'</span>...<span class="string">' '</span>...<span class="keywordsign">'</span>&gt; </code>.</li>
<li><code class="code"><span class="constructor">Some</span>(<span class="constructor">Derived</span> xid)</code>: There is a DOCTYPE declaration with
    a SYSTEM or PUBLIC identifier (described by <code class="code">xid</code>), <b>and</b> with
    brackets</li>
</ul>
<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODset_id"></a>set_id : <code class="type">Pxp_core_types.I.dtd_id -> unit</code></pre><div class="info">
set the identifier. This method can be invoked only once<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODencoding"></a>encoding : <code class="type">Pxp_core_types.I.rep_encoding</code></pre><div class="info">
returns the encoding used for character representation<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODlexer_factory"></a>lexer_factory : <code class="type">Pxp_lexer_types.lexer_factory</code></pre><div class="info">
Returns a lexer factory for the character encoding<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODallow_arbitrary"></a>allow_arbitrary : <code class="type">unit</code></pre><div class="info">
This method sets the <code class="code">arbitrary_allowed</code> flag. This flag disables
 a specific validation constraint, namely that all elements 
 need to be declared in the DTD. This feature is used
 to implement the well-formedness mode: In this mode, the element,
 attribute, and notation declarations found in the textual DTD are ignored, and not
 added to this DTD object. As the <code class="code">arbitrary_allowed</code> flag is also
 set, the net effect is that all validation checks regarding
 the values of elements and attributes are omitted. The flag is
 automatically set if the parser is called using one of the 
 "wf" functions, e.g. <a href="Pxp_tree_parser.html#VALparse_wfdocument_entity"><code class="code"><span class="constructor">Pxp_tree_parser</span>.parse_wfdocument_entity</code></a>.
<p>

 Technically, the <code class="code">arbitrary_allowed</code> flag changes the behaviour of
 the <code class="code">element</code> and <code class="code">notation</code> methods defined below so that they
 raise <code class="code"><span class="constructor">Undeclared</span></code> instead of <code class="code"><span class="constructor">Validation_error</span></code> when an unknown
 element or notation name is encountered.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODdisallow_arbitrary"></a>disallow_arbitrary : <code class="type">unit</code></pre><div class="info">
Clears the <code class="code">arbitrary_allowed</code> flag again<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODarbitrary_allowed"></a>arbitrary_allowed : <code class="type">bool</code></pre><div class="info">
Returns whether arbitrary contents are allowed or not.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODstandalone_declaration"></a>standalone_declaration : <code class="type">bool</code></pre><div class="info">
Whether there is a 'standalone' declaration or not.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODset_standalone_declaration"></a>set_standalone_declaration : <code class="type">bool -> unit</code></pre><div class="info">
Sets the 'standalone' declaration.<br>
</div>
<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">
For namespace-aware implementations of the node class, this method
 returns the namespace manager. If the namespace manager has not been
 set, the exception <code class="code"><span class="constructor">Not_found</span></code> is raised.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODset_namespace_manager"></a>set_namespace_manager : <code class="type"><a href="Pxp_dtd.namespace_manager.html">namespace_manager</a> -> unit</code></pre><div class="info">
Sets the namespace manager as returned by <code class="code">namespace_manager</code>.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODadd_element"></a>add_element : <code class="type"><a href="Pxp_dtd.dtd_element.html">dtd_element</a> -> unit</code></pre><div class="info">
add the given element declaration to this DTD. Raises <code class="code"><span class="constructor">Not_found</span></code>
 if there is already an element declaration with the same name.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODadd_gen_entity"></a>add_gen_entity : <code class="type">Pxp_entity.entity -> bool -> unit</code></pre><div class="info">
<code class="code">add_gen_entity e extdecl</code>:
 add the entity <code class="code">e</code> as general entity to this DTD (general entities
 are those represented by <code class="code"><span class="keywordsign">&amp;</span>name;</code>). If there is already a declaration
 with the same name, the second definition is ignored; as exception from
 this rule, entities with names "lt", "gt", "amp", "quot", and "apos"
 may only be redeclared with a definition that is equivalent to the
 standard definition; otherwise a <code class="code"><span class="constructor">Validation_error</span></code> is raised.
<p>

 <code class="code">extdecl</code>: true indicates that the entity declaration occurs in
 an external entity. (Used for the standalone check.)<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODadd_par_entity"></a>add_par_entity : <code class="type">Pxp_entity.entity -> unit</code></pre><div class="info">
add the given entity as parameter entity to this DTD (parameter
 entities are those represented by %name;). If there is already a 
 declaration with the same name, the second definition is ignored.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODadd_notation"></a>add_notation : <code class="type"><a href="Pxp_dtd.dtd_notation.html">dtd_notation</a> -> unit</code></pre><div class="info">
add the given notation to this DTD. If there is already a declaration
 with the same name, a <code class="code"><span class="constructor">Validation_error</span></code> is raised.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODadd_pinstr"></a>add_pinstr : <code class="type"><a href="Pxp_dtd.proc_instruction.html">proc_instruction</a> -> unit</code></pre><div class="info">
add the given processing instruction to this DTD.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODelement"></a>element : <code class="type">string -> <a href="Pxp_dtd.dtd_element.html">dtd_element</a></code></pre><div class="info">
looks up the element declaration with the given name. Raises 
 <code class="code"><span class="constructor">Validation_error</span></code> if the element cannot be found. If the
 <code class="code">arbitrary_allowed</code> flag is set, however, 
 <code class="code"><span class="constructor">Undeclared</span></code> is raised instead.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODelement_names"></a>element_names : <code class="type">string list</code></pre><div class="info">
returns the list of the names of all element declarations.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODgen_entity"></a>gen_entity : <code class="type">string -> Pxp_entity.entity * bool</code></pre><div class="info">
<code class="code"><span class="keyword">let</span> e, extdecl = obj <span class="keywordsign">#</span> gen_entity n</code>:
 looks up the general entity <code class="code">e</code> with the name <code class="code">n</code>. Raises
 <code class="code"><span class="constructor">WF_error</span></code> if the entity cannot be found.
<p>

 <code class="code">extdecl</code>: indicates whether the entity declaration occured in an 
 external entity.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODgen_entity_names"></a>gen_entity_names : <code class="type">string list</code></pre><div class="info">
returns the list of all general entity names<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODpar_entity"></a>par_entity : <code class="type">string -> Pxp_entity.entity</code></pre><div class="info">
looks up the parameter entity with the given name. Raises
 <code class="code"><span class="constructor">WF_error</span></code> if the entity cannot be found.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODpar_entity_names"></a>par_entity_names : <code class="type">string list</code></pre><div class="info">
returns the list of all parameter entity names<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODnotation"></a>notation : <code class="type">string -> <a href="Pxp_dtd.dtd_notation.html">dtd_notation</a></code></pre><div class="info">
looks up the notation declaration with the given name. Raises
 <code class="code"><span class="constructor">Validation_error</span></code> if the notation cannot be found. If the
 <code class="code">arbitrary_allowed</code> flag is sez, however, 
 <code class="code"><span class="constructor">Undeclared</span></code> is raised instead.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODnotation_names"></a>notation_names : <code class="type">string list</code></pre><div class="info">
Returns the list of the names of all added notations<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODpinstr"></a>pinstr : <code class="type">string -> <a href="Pxp_dtd.proc_instruction.html">proc_instruction</a> list</code></pre><div class="info">
looks up all processing instructions with the given target.
 The "target" is the identifier following <code class="code">&lt;?</code>.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODpinstr_names"></a>pinstr_names : <code class="type">string list</code></pre><div class="info">
Returns the list of the names (targets) of all added pinstrs<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODvalidate"></a>validate : <code class="type">unit</code></pre><div class="info">
ensures that the DTD is valid. This method is optimized such that
 actual validation is only performed if DTD has been changed.
 If the DTD is invalid, in most cases a <code class="code"><span class="constructor">Validation_error</span></code> is raised,
 but other exceptions are possible, too.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODonly_deterministic_models"></a>only_deterministic_models : <code class="type">unit</code></pre><div class="info">
Succeeds if all regexp content models are deterministic. 
 Otherwise <code class="code"><span class="constructor">Validation_error</span></code>.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODwrite"></a>write : <code class="type">?root:string -><br>       Pxp_core_types.I.output_stream -> Pxp_core_types.I.encoding -> bool -> unit</code></pre><div class="info">
<code class="code">write os enc doctype</code>:
 Writes the DTD as <code class="code">enc</code>-encoded string to <code class="code">os</code>. If <code class="code">doctype</code>, a 
 DTD like <code class="code"> &lt;!<span class="constructor">DOCTYPE</span> root [ ... ]&gt; </code> is written. If <code class="code">not doctype</code>,
 only the declarations are written (the material within the
 square brackets).
<p>

 The entity definitions are not written. However, it is ensured that
 the generated string does not contain any reference to an entity.
 The reason for the omission of the entites is that there is no
 generic way of writing references to external entities.
<p>

 Option <code class="code">root</code>: Override the name of the root element in  the 
 DOCTYPE clause.<br>
</div>
<pre><span class="keyword">method</span> <a name="METHODwrite_ref"></a>write_ref : <code class="type">?root:string -><br>       Pxp_core_types.I.output_stream -> Pxp_core_types.I.encoding -> unit</code></pre><div class="info">
<code class="code">write_ref os enc</code>:
 Writes a reference to the DTD as <code class="code">enc</code>-encoded string to <code class="code">os</code>.
 The reference looks as follows:
 <pre></pre><code class="code">&nbsp;&nbsp;&nbsp;&lt;!<span class="constructor">DOCTYPE</span>&nbsp;root&nbsp;<span class="constructor">SYSTEM</span>&nbsp;...&nbsp;&gt;&nbsp;<span class="keyword">or</span><br>
&nbsp;&nbsp;&nbsp;&lt;!<span class="constructor">DOCTYPE</span>&nbsp;root&nbsp;<span class="constructor">PUBLIC</span>&nbsp;...&nbsp;&gt;<br>
&nbsp;</code><pre></pre>
 Of course, the DTD must have an external ID:<ul>
<li>dtd#id = External(System ...) or</li>
<li>dtd#id = External(Public ...)</li>
</ul>

 If the DTD is internal or mixed, the method <code class="code">write_ref</code> will fail.
 If the ID is anonymous or private, the method will fail, too.
<p>

 Option <code class="code">root</code>: Override the name of the root element in  the 
 DOCTYPE clause.<br>
</div>
</body></html>