diff options
Diffstat (limited to 'docs/manual')
-rw-r--r-- | docs/manual/access.html | 4 | ||||
-rw-r--r-- | docs/manual/apiref.html | 47 | ||||
-rw-r--r-- | docs/manual/dom.html | 48 | ||||
-rw-r--r-- | docs/manual/loading.html | 36 | ||||
-rw-r--r-- | docs/manual/saving.html | 50 | ||||
-rw-r--r-- | docs/manual/xpath.html | 44 |
6 files changed, 113 insertions, 116 deletions
diff --git a/docs/manual/access.html b/docs/manual/access.html index 4581583..1accecb 100644 --- a/docs/manual/access.html +++ b/docs/manual/access.html @@ -624,9 +624,7 @@ <p> This function returns the node with type <code class="computeroutput"><span class="identifier">node_document</span></code>, which is the root node of the document the node belongs to (unless the node - is null, in which case null node is returned). Currently this function has - logarithmic complexity, since it simply finds such ancestor of the given - node which itself has no parent. + is null, in which case null node is returned). </p> <a name="xml_node::path"></a><a name="xml_node::first_element_by_path"></a><p> While pugixml supports complex XPath expressions, sometimes a simple path diff --git a/docs/manual/apiref.html b/docs/manual/apiref.html index 24120ad..5e595cf 100644 --- a/docs/manual/apiref.html +++ b/docs/manual/apiref.html @@ -800,7 +800,15 @@ <span class="special">=</span> <span class="identifier">parse_default</span><span class="special">,</span> <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span> <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">);</span></code> - <br><br> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_parse_result</span> </code><a class="link" href="loading.html#xml_document::load_file_wide">load_file</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> + <span class="identifier">path</span><span class="special">,</span> + <span class="keyword">unsigned</span> <span class="keyword">int</span> + <span class="identifier">options</span> <span class="special">=</span> + <span class="identifier">parse_default</span><span class="special">,</span> + <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span> + <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">);</span></code> <br><br> </li> <li class="listitem"> @@ -839,6 +847,17 @@ <span class="identifier">encoding</span> <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="saving.html#xml_document::save_file_wide">save_file</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> + <span class="identifier">path</span><span class="special">,</span> + <span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">indent</span> + <span class="special">=</span> <span class="string">"\t"</span><span class="special">,</span> <span class="keyword">unsigned</span> + <span class="keyword">int</span> <span class="identifier">flags</span> + <span class="special">=</span> <span class="identifier">format_default</span><span class="special">,</span> <span class="identifier">xml_encoding</span> + <span class="identifier">encoding</span> <span class="special">=</span> + <span class="identifier">encoding_auto</span><span class="special">)</span> + <span class="keyword">const</span><span class="special">;</span></code> <br><br> </li> @@ -893,6 +912,9 @@ </li> <li class="listitem"> + <a class="link" href="loading.html#xml_parse_result::ctor">xml_parse_result</a><code class="computeroutput"><span class="special">();</span></code> + </li> +<li class="listitem"> <code class="computeroutput"><span class="keyword">operator</span> </code><a class="link" href="loading.html#xml_parse_result::bool">bool</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> </li> <li class="listitem"> @@ -1107,23 +1129,12 @@ <p> Functions: </p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc"> -<li class="listitem"> - <a class="link" href="dom.html#as_utf8">as_utf8</a> - </li> -<li class="listitem"> - <a class="link" href="dom.html#as_wide">as_wide</a> - </li> -<li class="listitem"> - <a class="link" href="dom.html#get_memory_allocation_function">get_memory_allocation_function</a> - </li> -<li class="listitem"> - <a class="link" href="dom.html#get_memory_deallocation_function">get_memory_deallocation_function</a> - </li> -<li class="listitem"> - <a class="link" href="dom.html#set_memory_management_functions">set_memory_management_functions</a> - </li> -</ul></div> +<p> + $$ overloads, types * <a class="link" href="dom.html#as_utf8">as_utf8</a> * <a class="link" href="dom.html#as_wide">as_wide</a> + * <a class="link" href="dom.html#get_memory_allocation_function">get_memory_allocation_function</a> + * <a class="link" href="dom.html#get_memory_deallocation_function">get_memory_deallocation_function</a> + * <a class="link" href="dom.html#set_memory_management_functions">set_memory_management_functions</a> + </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> diff --git a/docs/manual/dom.html b/docs/manual/dom.html index 2d65070..def86a5 100644 --- a/docs/manual/dom.html +++ b/docs/manual/dom.html @@ -371,9 +371,10 @@ </p></td></tr> </table></div> <p> - All tree functions that work with strings work with either C-style null terminated - strings or STL strings of the selected character type. For example, node - name accessors look like this in char mode: + $$ wording - one may think that child() has a string overload All tree functions + that work with strings work with either C-style null terminated strings or + STL strings of the selected character type. For example, node name accessors + look like this in char mode: </p> <pre class="programlisting"><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">name</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">bool</span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">set_name</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">value</span><span class="special">);</span> @@ -416,7 +417,12 @@ performs conversion from UTF-8 to UTF-16/32. Invalid UTF sequences are silently discarded upon conversion. <code class="computeroutput"><span class="identifier">str</span></code> has to be a valid string; passing null pointer results in undefined behavior. + There are also two overloads with the same semantics which accept a string + as an argument: </p> +<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">as_utf8</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span><span class="special">&</span> <span class="identifier">str</span><span class="special">);</span> +<span class="identifier">std</span><span class="special">::</span><span class="identifier">wstring</span> <span class="identifier">as_wide</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&</span> <span class="identifier">str</span><span class="special">);</span> +</pre> <div class="note"><table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td> @@ -493,7 +499,7 @@ guarantees beyond the ones provided by callback. </p> <p> - XPath functions may throw <code class="computeroutput"><span class="identifier">xpath_exception</span></code> + $$ XPath functions may throw <code class="computeroutput"><span class="identifier">xpath_exception</span></code> on parsing error; also, XPath implementation uses STL, and thus may throw i.e. <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code> in low memory conditions. Still, XPath functions provide strong exception guarantee. @@ -514,10 +520,10 @@ functions</a> </h4></div></div></div> <a name="allocation_function"></a><a name="deallocation_function"></a><p> - All memory for tree structure/data is allocated via globally specified - functions, which default to malloc/free. You can set your own allocation - functions with set_memory_management functions. The function interfaces - are the same as that of malloc/free: + All memory for tree structure, tree data and XPath objects is allocated + via globally specified functions, which default to malloc/free. You can + set your own allocation functions with set_memory_management functions. + The function interfaces are the same as that of malloc/free: </p> <pre class="programlisting"><span class="keyword">typedef</span> <span class="keyword">void</span><span class="special">*</span> <span class="special">(*</span><span class="identifier">allocation_function</span><span class="special">)(</span><span class="identifier">size_t</span> <span class="identifier">size</span><span class="special">);</span> <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">deallocation_function</span><span class="special">)(</span><span class="keyword">void</span><span class="special">*</span> <span class="identifier">ptr</span><span class="special">);</span> @@ -533,13 +539,15 @@ <p> Allocation function is called with the size (in bytes) as an argument and should return a pointer to memory block with alignment that is suitable - for pointer storage and size that is greater or equal to the requested - one. If the allocation fails, the function has to return null pointer (throwing - an exception from allocation function results in undefined behavior). Deallocation - function is called with the pointer that was returned by the previous call - or with a null pointer; null pointer deallocation should be handled as - a no-op. If memory management functions are not thread-safe, library thread - safety is not guaranteed. + for storage of primitive types (usually a maximum of pointer and <code class="computeroutput"><span class="keyword">double</span></code> types alignment is sufficient) and + size that is greater or equal to the requested one. If the allocation fails, + the function has to return null pointer (throwing an exception from allocation + function results in undefined behavior). + </p> +<p> + Deallocation function is called with the pointer that was returned by the + previous call; it is never called with a null pointer. If memory management + functions are not thread-safe, library thread safety is not guaranteed. </p> <p> This is a simple example of custom memory management (<a href="../samples/custom_memory_management.cpp" target="_top">samples/custom_memory_management.cpp</a>): @@ -572,16 +580,6 @@ are destroyed, the new deallocation function will be called with the memory obtained by the old allocation function, resulting in undefined behavior. </p> -<div class="note"><table border="0" summary="Note"> -<tr> -<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td> -<th align="left">Note</th> -</tr> -<tr><td align="left" valign="top"><p> - Currently memory for XPath objects is allocated using default operators - new/delete; this will change in the next version. - </p></td></tr> -</table></div> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> diff --git a/docs/manual/loading.html b/docs/manual/loading.html index a3c1515..547b355 100644 --- a/docs/manual/loading.html +++ b/docs/manual/loading.html @@ -65,20 +65,27 @@ <div class="titlepage"><div><div><h3 class="title"> <a name="manual.loading.file"></a><a class="link" href="loading.html#manual.loading.file" title="Loading document from file"> Loading document from file</a> </h3></div></div></div> -<a name="xml_document::load_file"></a><p> - The most common source of XML data is files; pugixml provides a separate - function for loading XML document from file: +<a name="xml_document::load_file"></a><a name="xml_document::load_file_wide"></a><p> + The most common source of XML data is files; pugixml provides dedicated functions + for loading XML document from file: </p> <pre class="programlisting"><span class="identifier">xml_parse_result</span> <span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">load_file</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">path</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">options</span> <span class="special">=</span> <span class="identifier">parse_default</span><span class="special">,</span> <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span> <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">);</span> +<span class="identifier">xml_parse_result</span> <span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">load_file</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">path</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">options</span> <span class="special">=</span> <span class="identifier">parse_default</span><span class="special">,</span> <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span> <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">);</span> </pre> <p> - This function accepts file path as its first argument, and also two optional + These functions accept file path as its first argument, and also two optional arguments, which specify parsing options (see <a class="xref" href="loading.html#manual.loading.options" title="Parsing options"> Parsing options</a>) and input data encoding (see <a class="xref" href="loading.html#manual.loading.encoding" title="Encodings"> Encodings</a>). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of target system, it should have the exact case if target - file system is case-sensitive, etc. File path is passed to system file opening - function as is. + file system is case-sensitive, etc. + </p> +<p> + File path is passed to system file opening function as is in case of the + first function (which accepts <code class="computeroutput"><span class="keyword">const</span> + <span class="keyword">char</span><span class="special">*</span> <span class="identifier">path</span></code>); the second function either uses + a special file opening function if it is provided by the runtime library + or converts the path to UTF-8 and uses the system file opening function. </p> <p> <code class="computeroutput"><span class="identifier">load_file</span></code> destroys the existing @@ -88,20 +95,6 @@ (i.e. last successfully parsed position in the input file, if parsing fails). See <a class="xref" href="loading.html#manual.loading.errors" title="Handling parsing errors"> Handling parsing errors</a> for error handling details. </p> -<div class="note"><table border="0" summary="Note"> -<tr> -<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td> -<th align="left">Note</th> -</tr> -<tr><td align="left" valign="top"><p> - As of version 0.9, there is no function for loading XML document from wide - character path. Unfortunately, there is no portable way to do this; the - version 1.0 will provide such function only for platforms with the corresponding - functionality. You can use stream-loading functions as a workaround if - your STL implementation can open file streams via <code class="computeroutput"><span class="keyword">wchar_t</span></code> - paths. - </p></td></tr> -</table></div> <p> This is an example of loading XML document from file (<a href="../samples/load_file.cpp" target="_top">samples/load_file.cpp</a>): </p> @@ -297,7 +290,7 @@ <div class="titlepage"><div><div><h3 class="title"> <a name="manual.loading.errors"></a><a class="link" href="loading.html#manual.loading.errors" title="Handling parsing errors"> Handling parsing errors</a> </h3></div></div></div> -<a name="xml_parse_result"></a><p> +<a name="xml_parse_result"></a><a name="xml_parse_result::ctor"></a><p> All document loading functions return the parsing result via <code class="computeroutput"><span class="identifier">xml_parse_result</span></code> object. It contains parsing status, the offset of last successfully parsed character from the beginning of the source stream, and the encoding of the source stream: @@ -308,6 +301,7 @@ <span class="identifier">ptrdiff_t</span> <span class="identifier">offset</span><span class="special">;</span> <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span><span class="special">;</span> + <span class="identifier">xml_parse_result</span><span class="special">();</span> <span class="keyword">operator</span> <span class="keyword">bool</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">description</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="special">};</span> diff --git a/docs/manual/saving.html b/docs/manual/saving.html index e12b31d..584cb2c 100644 --- a/docs/manual/saving.html +++ b/docs/manual/saving.html @@ -56,35 +56,38 @@ For proper output, make sure all node and attribute names are set to meaningful values. </p> -<div class="caution"><table border="0" summary="Caution"> -<tr> -<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../images/caution.png"></td> -<th align="left">Caution</th> -</tr> -<tr><td align="left" valign="top"><p> - Currently the content of CDATA sections is not escaped, so CDATA sections - with values that contain <code class="computeroutput"><span class="string">"]]>"</span></code> - will result in malformed document. This will be fixed in version 1.0. - </p></td></tr> -</table></div> +<p> + CDATA sections with values that contain <code class="computeroutput"><span class="string">"]]>"</span></code> + are split into several sections as follows: section with value <code class="computeroutput"><span class="string">"pre]]>post"</span></code> is written as <code class="computeroutput"><span class="special"><![</span><span class="identifier">CDATA</span><span class="special">[</span><span class="identifier">pre</span><span class="special">]]]]><![</span><span class="identifier">CDATA</span><span class="special">[></span><span class="identifier">post</span><span class="special">]]></span></code>. + While this alters the structure of the document (if you load the document after + saving it, there will be two CDATA sections instead of one), this is the only + way to escape CDATA contents. + </p> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> <a name="manual.saving.file"></a><a class="link" href="saving.html#manual.saving.file" title="Saving document to a file"> Saving document to a file</a> </h3></div></div></div> -<a name="xml_document::save_file"></a><p> - If you want to save the whole document to a file, you can use the following - function: +<a name="xml_document::save_file"></a><a name="xml_document::save_file_wide"></a><p> + If you want to save the whole document to a file, you can use one of the + following functions: </p> <pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">save_file</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">path</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">indent</span> <span class="special">=</span> <span class="string">"\t"</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">,</span> <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span> <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">bool</span> <span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">save_file</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">path</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">indent</span> <span class="special">=</span> <span class="string">"\t"</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="identifier">format_default</span><span class="special">,</span> <span class="identifier">xml_encoding</span> <span class="identifier">encoding</span> <span class="special">=</span> <span class="identifier">encoding_auto</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> </pre> <p> - This function accepts file path as its first argument, and also three optional + These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see <a class="xref" href="saving.html#manual.saving.options" title="Output options"> Output options</a>) and output data encoding (see <a class="xref" href="saving.html#manual.saving.encoding" title="Encodings"> Encodings</a>). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of target system, it should have the exact case if target - file system is case-sensitive, etc. File path is passed to system file opening - function as is. + file system is case-sensitive, etc. + </p> +<p> + File path is passed to system file opening function as is in case of the + first function (which accepts <code class="computeroutput"><span class="keyword">const</span> + <span class="keyword">char</span><span class="special">*</span> <span class="identifier">path</span></code>); the second function either uses + a special file opening function if it is provided by the runtime library + or converts the path to UTF-8 and uses the system file opening function. </p> <a name="xml_writer_file"></a><p> <code class="computeroutput"><span class="identifier">save_file</span></code> opens the target @@ -96,19 +99,6 @@ handle as the only constructor argument and then calling <code class="computeroutput"><span class="identifier">save</span></code>; see <a class="xref" href="saving.html#manual.saving.writer" title="Saving document via writer interface"> Saving document via writer interface</a> for writer interface details. </p> -<div class="note"><table border="0" summary="Note"> -<tr> -<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td> -<th align="left">Note</th> -</tr> -<tr><td align="left" valign="top"><p> - As of version 0.9, there is no function for saving XML document to wide - character paths. Unfortunately, there is no portable way to do this; the - version 1.0 will provide such function only for platforms with the corresponding - functionality. You can use stream-saving functions as a workaround if your - STL implementation can open file streams via wchar_t paths. - </p></td></tr> -</table></div> <p> This is a simple example of saving XML document to file (<a href="../samples/save_file.cpp" target="_top">samples/save_file.cpp</a>): </p> diff --git a/docs/manual/xpath.html b/docs/manual/xpath.html index 731a969..513bb90 100644 --- a/docs/manual/xpath.html +++ b/docs/manual/xpath.html @@ -54,6 +54,9 @@ at tizag.com</a>, and <a href="http://www.w3.org/TR/xpath/" target="_top">the XPath 1.0 specification</a>. </p> +<p> + $$ + </p> <div class="note"><table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td> @@ -120,9 +123,11 @@ You can also create XPath nodes with one of tree constructors: the default constructor, the constructor that takes node argument, and the constructor that takes attribute and node arguments (in which case the attribute must - belong to the attribute list of the node). However, usually you don't need - to create your own XPath node objects, since they are returned to you via - selection functions. + belong to the attribute list of the node). The constructor from <code class="computeroutput"><span class="identifier">xml_node</span></code> is implicit, so you can usually + pass <code class="computeroutput"><span class="identifier">xml_node</span></code> to functions + that expect <code class="computeroutput"><span class="identifier">xpath_node</span></code>. Apart + from that you usually don't need to create your own XPath node objects, since + they are returned to you via selection functions. </p> <a name="xpath_node_set"></a><p> XPath expressions operate not on single nodes, but instead on node sets. @@ -309,20 +314,21 @@ <a name="xpath_query::evaluate_boolean"></a><a name="xpath_query::evaluate_number"></a><a name="xpath_query::evaluate_string"></a><a name="xpath_query::evaluate_node_set"></a><p> You can evaluate the query using one of the following functions: </p> -<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_boolean</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xml_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> -<span class="keyword">double</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_number</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xml_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> -<span class="identifier">string_t</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_string</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xml_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> -<span class="identifier">xpath_node_set</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_node_set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xml_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_boolean</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xpath_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">double</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_number</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xpath_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="identifier">string_t</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_string</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xpath_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="identifier">xpath_node_set</span> <span class="identifier">xpath_query</span><span class="special">::</span><span class="identifier">evaluate_node_set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">xpath_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> </pre> <p> - All functions take the context node as an argument, compute the expression - and return the result, converted to the requested type. By XPath specification, - value of any type can be converted to boolean, number or string value, but - no type other than node set can be converted to node set. Because of this, - <code class="computeroutput"><span class="identifier">evaluate_boolean</span></code>, <code class="computeroutput"><span class="identifier">evaluate_number</span></code> and <code class="computeroutput"><span class="identifier">evaluate_string</span></code> - always return a result, but <code class="computeroutput"><span class="identifier">evaluate_node_set</span></code> - throws an <code class="computeroutput"><span class="identifier">xpath_exception</span></code> - if the return type is not node set. + $$ exception, evaluate_string nostl All functions take the context node as + an argument, compute the expression and return the result, converted to the + requested type. By XPath specification, value of any type can be converted + to boolean, number or string value, but no type other than node set can be + converted to node set. Because of this, <code class="computeroutput"><span class="identifier">evaluate_boolean</span></code>, + <code class="computeroutput"><span class="identifier">evaluate_number</span></code> and <code class="computeroutput"><span class="identifier">evaluate_string</span></code> always return a result, + but <code class="computeroutput"><span class="identifier">evaluate_node_set</span></code> throws + an <code class="computeroutput"><span class="identifier">xpath_exception</span></code> if the + return type is not node set. </p> <div class="note"><table border="0" summary="Note"> <tr> @@ -370,7 +376,7 @@ <a name="manual.xpath.errors"></a><a class="link" href="xpath.html#manual.xpath.errors" title="Error handling"> Error handling</a> </h3></div></div></div> <a name="xpath_exception"></a><a name="xpath_exception::what"></a><p> - As of version 0.9, all XPath errors result in thrown exceptions. The errors + $$ As of version 0.9, all XPath errors result in thrown exceptions. The errors can arise during expression compilation or node set evaluation. In both cases, an <code class="computeroutput"><span class="identifier">xpath_exception</span></code> object is thrown. This is an exception object that implements <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span></code> @@ -379,8 +385,8 @@ <pre class="programlisting"><span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">xpath_exception</span><span class="special">::</span><span class="identifier">what</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">throw</span><span class="special">();</span> </pre> <p> - This function returns the error message. Currently it is impossible to get - the exact place where query compilation failed. This functionality, along + $$ This function returns the error message. Currently it is impossible to + get the exact place where query compilation failed. This functionality, along with optional error handling without exceptions, will be available in version 1.0. </p> @@ -464,7 +470,7 @@ </li> </ul></div> <p> - Some of these incompatibilities will be fixed in version 1.0. + $$ Some of these incompatibilities will be fixed in version 1.0. </p> </div> </div> |