diff options
Diffstat (limited to 'docs/manual')
-rw-r--r-- | docs/manual/access.html | 208 | ||||
-rw-r--r-- | docs/manual/apiref.html | 182 | ||||
-rw-r--r-- | docs/manual/changes.html | 104 | ||||
-rw-r--r-- | docs/manual/dom.html | 70 | ||||
-rw-r--r-- | docs/manual/install.html | 88 | ||||
-rw-r--r-- | docs/manual/loading.html | 44 | ||||
-rw-r--r-- | docs/manual/modify.html | 90 | ||||
-rw-r--r-- | docs/manual/saving.html | 110 | ||||
-rw-r--r-- | docs/manual/toc.html | 17 | ||||
-rw-r--r-- | docs/manual/xpath.html | 16 |
10 files changed, 829 insertions, 100 deletions
diff --git a/docs/manual/access.html b/docs/manual/access.html index d4b38c2..dcb072d 100644 --- a/docs/manual/access.html +++ b/docs/manual/access.html @@ -4,15 +4,15 @@ <title>Accessing document data</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="loading.html" title="Loading document"> <link rel="next" href="modify.html" title="Modifying document data"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -35,11 +35,13 @@ <dt><span class="section"><a href="access.html#manual.access.nodedata"> Getting node data</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.attrdata"> Getting attribute data</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.contents"> Contents-based traversal functions</a></span></dt> +<dt><span class="section"><a href="access.html#manual.access.rangefor"> Range-based for-loop support</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.iterators"> Traversing node/attribute lists via iterators</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.walker"> Recursive traversal with xml_tree_walker</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.predicate"> Searching for nodes/attributes with predicates</a></span></dt> +<dt><span class="section"><a href="access.html#manual.access.text"> Working with text contents</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.misc"> Miscellaneous functions</a></span></dt> </dl></div> <p> @@ -167,10 +169,11 @@ In this case, <code class="computeroutput"><span class="special"><</span><span class="identifier">description</span><span class="special">></span></code> node does not have a value, but instead has a child of type <a class="link" href="dom.html#node_pcdata">node_pcdata</a> with value <code class="computeroutput"><span class="string">"This is a node"</span></code>. pugixml - provides two helper functions to parse such data: + provides several helper functions to parse such data: </p> <pre class="programlisting"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">child_value</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">child_value</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</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="identifier">xml_text</span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">text</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> </pre> <p> <code class="computeroutput"><span class="identifier">child_value</span><span class="special">()</span></code> @@ -182,6 +185,12 @@ functions return empty string. </p> <p> + <code class="computeroutput"><span class="identifier">text</span><span class="special">()</span></code> + returns a special object that can be used for working with PCDATA contents + in more complex cases than just retrieving the value; it is described in + <a class="xref" href="access.html#manual.access.text" title="Working with text contents"> Working with text contents</a> sections. + </p> +<p> There is an example of using some of these functions <a class="link" href="access.html#code_traverse_base_data">at the end of the next section</a>. </p> @@ -201,26 +210,40 @@ In case the attribute handle is null, both functions return empty strings - they never return null pointers. </p> +<a name="xml_attribute::as_string"></a><p> + If you need a non-empty string if the attribute handle is null (for example, + you need to get the option value from XML attribute, but if it is not specified, + you need it to default to <code class="computeroutput"><span class="string">"sorted"</span></code> + instead of <code class="computeroutput"><span class="string">""</span></code>), you + can use <code class="computeroutput"><span class="identifier">as_string</span></code> accessor: + </p> +<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_string</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">def</span> <span class="special">=</span> <span class="string">""</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<p> + It returns <code class="computeroutput"><span class="identifier">def</span></code> argument if + the attribute handle is null. If you do not specify the argument, the function + is equivalent to <code class="computeroutput"><span class="identifier">value</span><span class="special">()</span></code>. + </p> <a name="xml_attribute::as_int"></a><a name="xml_attribute::as_uint"></a><a name="xml_attribute::as_double"></a><a name="xml_attribute::as_float"></a><a name="xml_attribute::as_bool"></a><p> In many cases attribute values have types that are not strings - i.e. an attribute may always contain values that should be treated as integers, despite the fact that they are represented as strings in XML. pugixml provides several accessors that convert attribute value to some other type: </p> -<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_int</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> -<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_uint</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> -<span class="keyword">double</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_double</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> -<span class="keyword">float</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_float</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> -<span class="keyword">bool</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_bool</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_int</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_uint</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">double</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_double</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">float</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_float</span><span class="special">(</span><span class="keyword">float</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">bool</span> <span class="identifier">xml_attribute</span><span class="special">::</span><span class="identifier">as_bool</span><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">def</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> </pre> <p> <code class="computeroutput"><span class="identifier">as_int</span></code>, <code class="computeroutput"><span class="identifier">as_uint</span></code>, <code class="computeroutput"><span class="identifier">as_double</span></code> and <code class="computeroutput"><span class="identifier">as_float</span></code> convert attribute values to numbers. - If attribute handle is null or attribute value is empty, <code class="computeroutput"><span class="number">0</span></code> - is returned. Otherwise, all leading whitespace characters are truncated, - and the remaining string is parsed as a decimal number (<code class="computeroutput"><span class="identifier">as_int</span></code> - or <code class="computeroutput"><span class="identifier">as_uint</span></code>) or as a floating - point number in either decimal or scientific form (<code class="computeroutput"><span class="identifier">as_double</span></code> + If attribute handle is null or attribute value is empty, <code class="computeroutput"><span class="identifier">def</span></code> + argument is returned (which is 0 by default). Otherwise, all leading whitespace + characters are truncated, and the remaining string is parsed as a decimal + number (<code class="computeroutput"><span class="identifier">as_int</span></code> or <code class="computeroutput"><span class="identifier">as_uint</span></code>) or as a floating point number + in either decimal or scientific form (<code class="computeroutput"><span class="identifier">as_double</span></code> or <code class="computeroutput"><span class="identifier">as_float</span></code>). Any extra characters are silently discarded, i.e. <code class="computeroutput"><span class="identifier">as_int</span></code> will return <code class="computeroutput"><span class="number">1</span></code> for string <code class="computeroutput"><span class="string">"1abc"</span></code>. @@ -241,10 +264,11 @@ </table></div> <p> <code class="computeroutput"><span class="identifier">as_bool</span></code> converts attribute - value to boolean as follows: if attribute handle is null or attribute value - is empty, <code class="computeroutput"><span class="keyword">false</span></code> is returned. - Otherwise, <code class="computeroutput"><span class="keyword">true</span></code> is returned - if the first character is one of <code class="computeroutput"><span class="char">'1'</span><span class="special">,</span> <span class="char">'t'</span><span class="special">,</span> + value to boolean as follows: if attribute handle is null, <code class="computeroutput"><span class="identifier">def</span></code> + argument is returned (which is <code class="computeroutput"><span class="keyword">false</span></code> + by default). If attribute value is empty, <code class="computeroutput"><span class="keyword">false</span></code> + is returned. Otherwise, <code class="computeroutput"><span class="keyword">true</span></code> + is returned if the first character is one of <code class="computeroutput"><span class="char">'1'</span><span class="special">,</span> <span class="char">'t'</span><span class="special">,</span> <span class="char">'T'</span><span class="special">,</span> <span class="char">'y'</span><span class="special">,</span> <span class="char">'Y'</span></code>. This means that strings like <code class="computeroutput"><span class="string">"true"</span></code> and <code class="computeroutput"><span class="string">"yes"</span></code> are recognized @@ -347,6 +371,56 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> +<a name="manual.access.rangefor"></a><a class="link" href="access.html#manual.access.rangefor" title="Range-based for-loop support"> Range-based for-loop support</a> +</h3></div></div></div> +<a name="xml_node::children"></a><a name="xml_node::attributes"></a><p> + If your C++ compiler supports range-based for-loop (this is a C++11 feature, + at the time of writing it's supported by Microsoft Visual Studio 11 Beta, + GCC 4.6 and Clang 3.0), you can use it to enumerate nodes/attributes. Additional + helpers are provided to support this; note that they are also compatible + with <a href="http://www.boost.org/libs/foreach/" target="_top">Boost Foreach</a>, + and possibly other pre-C++11 foreach facilities. + </p> +<pre class="programlisting"><span class="emphasis"><em>implementation-defined type</em></span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">children</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +<span class="emphasis"><em>implementation-defined type</em></span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">children</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</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="emphasis"><em>implementation-defined type</em></span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">attributes</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<p> + <code class="computeroutput"><span class="identifier">children</span></code> function allows + you to enumerate all child nodes; <code class="computeroutput"><span class="identifier">children</span></code> + function with <code class="computeroutput"><span class="identifier">name</span></code> argument + allows you to enumerate all child nodes with a specific name; <code class="computeroutput"><span class="identifier">attributes</span></code> function allows you to enumerate + all attributes of the node. Note that you can also use node object itself + in a range-based for construct, which is equivalent to using <code class="computeroutput"><span class="identifier">children</span><span class="special">()</span></code>. + </p> +<p> + This is an example of using these functions (<a href="../samples/traverse_rangefor.cpp" target="_top">samples/traverse_rangefor.cpp</a>): + </p> +<p> + +</p> +<pre class="programlisting"><span class="keyword">for</span> <span class="special">(</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">tool</span><span class="special">:</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">children</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">))</span> +<span class="special">{</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Tool:"</span><span class="special">;</span> + + <span class="keyword">for</span> <span class="special">(</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_attribute</span> <span class="identifier">attr</span><span class="special">:</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">attributes</span><span class="special">())</span> + <span class="special">{</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" "</span> <span class="special"><<</span> <span class="identifier">attr</span><span class="special">.</span><span class="identifier">name</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"="</span> <span class="special"><<</span> <span class="identifier">attr</span><span class="special">.</span><span class="identifier">value</span><span class="special">();</span> + <span class="special">}</span> + + <span class="keyword">for</span> <span class="special">(</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">child</span><span class="special">:</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">children</span><span class="special">())</span> + <span class="special">{</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">", child "</span> <span class="special"><<</span> <span class="identifier">child</span><span class="special">.</span><span class="identifier">name</span><span class="special">();</span> + <span class="special">}</span> + + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +<span class="special">}</span> +</pre> +<p> + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> <a name="manual.access.iterators"></a><a class="link" href="access.html#manual.access.iterators" title="Traversing node/attribute lists via iterators"> Traversing node/attribute lists via iterators</a> </h3></div></div></div> @@ -616,6 +690,100 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> +<a name="manual.access.text"></a><a class="link" href="access.html#manual.access.text" title="Working with text contents"> Working with text contents</a> +</h3></div></div></div> +<a name="xml_text"></a><p> + It is common to store data as text contents of some node - i.e. <code class="computeroutput"><span class="special"><</span><span class="identifier">node</span><span class="special">><</span><span class="identifier">description</span><span class="special">></span><span class="identifier">This</span> <span class="identifier">is</span> <span class="identifier">a</span> <span class="identifier">node</span><span class="special"></</span><span class="identifier">description</span><span class="special">></</span><span class="identifier">node</span><span class="special">></span></code>. + In this case, <code class="computeroutput"><span class="special"><</span><span class="identifier">description</span><span class="special">></span></code> node does not have a value, but instead + has a child of type <a class="link" href="dom.html#node_pcdata">node_pcdata</a> with value + <code class="computeroutput"><span class="string">"This is a node"</span></code>. pugixml + provides a special class, <code class="computeroutput"><span class="identifier">xml_text</span></code>, + to work with such data. Working with text objects to modify data is described + in <a class="link" href="modify.html#manual.modify.text" title="Working with text contents">the documentation for modifying document + data</a>; this section describes the access interface of <code class="computeroutput"><span class="identifier">xml_text</span></code>. + </p> +<a name="xml_node::text"></a><p> + You can get the text object from a node by using <code class="computeroutput"><span class="identifier">text</span><span class="special">()</span></code> method: + </p> +<pre class="programlisting"><span class="identifier">xml_text</span> <span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">text</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<p> + If the node has a type <code class="computeroutput"><span class="identifier">node_pcdata</span></code> + or <code class="computeroutput"><span class="identifier">node_cdata</span></code>, then the node + itself is used to return data; otherwise, a first child node of type <code class="computeroutput"><span class="identifier">node_pcdata</span></code> or <code class="computeroutput"><span class="identifier">node_cdata</span></code> + is used. + </p> +<a name="xml_text::empty"></a><a name="xml_text::unspecified_bool_type"></a><p> + You can check if the text object is bound to a valid PCDATA/CDATA node by + using it as a boolean value, i.e. <code class="computeroutput"><span class="keyword">if</span> + <span class="special">(</span><span class="identifier">text</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> + <span class="special">}</span></code> or <code class="computeroutput"><span class="keyword">if</span> + <span class="special">(!</span><span class="identifier">text</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> + <span class="special">}</span></code>. Alternatively you can check it + by using the <code class="computeroutput"><span class="identifier">empty</span><span class="special">()</span></code> + method: + </p> +<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">empty</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<a name="xml_text::get"></a><p> + Given a text object, you can get the contents (i.e. the value of PCDATA/CDATA + node) by using the following function: + </p> +<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<p> + In case text object is empty, the function returns an empty string - it never + returns a null pointer. + </p> +<a name="xml_text::as_string"></a><a name="xml_text::as_int"></a><a name="xml_text::as_uint"></a><a name="xml_text::as_double"></a><a name="xml_text::as_float"></a><a name="xml_text::as_bool"></a><p> + If you need a non-empty string if the text object is empty, or if the text + contents is actually a number or a boolean that is stored as a string, you + can use the following accessors: + </p> +<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">as_string</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">def</span> <span class="special">=</span> <span class="string">""</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">as_int</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">as_uint</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">double</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">as_double</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">float</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">as_float</span><span class="special">(</span><span class="keyword">float</span> <span class="identifier">def</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +<span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">as_bool</span><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">def</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<p> + All of the above functions have the same semantics as similar <code class="computeroutput"><span class="identifier">xml_attribute</span></code> members: they return the + default argument if the text object is empty, they convert the text contents + to a target type using the same rules and restrictions. You can <a class="link" href="access.html#xml_attribute::as_int">refer + to documentation for the attribute functions</a> for details. + </p> +<a name="xml_text::data"></a><p> + <code class="computeroutput"><span class="identifier">xml_text</span></code> is essentially a + helper class that operates on <code class="computeroutput"><span class="identifier">xml_node</span></code> + values. It is bound to a node of type <a class="link" href="dom.html#node_pcdata">node_pcdata</a> + or [node_cdata]. You can use the following function to retrieve this node: + </p> +<pre class="programlisting"><span class="identifier">xml_node</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">data</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> +</pre> +<p> + Essentially, assuming <code class="computeroutput"><span class="identifier">text</span></code> + is an <code class="computeroutput"><span class="identifier">xml_text</span></code> object, callling + <code class="computeroutput"><span class="identifier">text</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span></code> is + equivalent to calling <code class="computeroutput"><span class="identifier">text</span><span class="special">.</span><span class="identifier">data</span><span class="special">().</span><span class="identifier">value</span><span class="special">()</span></code>. + </p> +<p> + This is an example of using <code class="computeroutput"><span class="identifier">xml_text</span></code> + object (<a href="../samples/text.cpp" target="_top">samples/text.cpp</a>): + </p> +<p> + +</p> +<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Project name: "</span> <span class="special"><<</span> <span class="identifier">project</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"name"</span><span class="special">).</span><span class="identifier">text</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Project version: "</span> <span class="special"><<</span> <span class="identifier">project</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"version"</span><span class="special">).</span><span class="identifier">text</span><span class="special">().</span><span class="identifier">as_double</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Project visibility: "</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">project</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"public"</span><span class="special">).</span><span class="identifier">text</span><span class="special">().</span><span class="identifier">as_bool</span><span class="special">(/*</span> <span class="identifier">def</span><span class="special">=</span> <span class="special">*/</span> <span class="keyword">true</span><span class="special">)</span> <span class="special">?</span> <span class="string">"public"</span> <span class="special">:</span> <span class="string">"private"</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Project description: "</span> <span class="special"><<</span> <span class="identifier">project</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"description"</span><span class="special">).</span><span class="identifier">text</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +</pre> +<p> + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> <a name="manual.access.misc"></a><a class="link" href="access.html#manual.access.misc" title="Miscellaneous functions"> Miscellaneous functions</a> </h3></div></div></div> <a name="xml_node::root"></a><p> @@ -698,7 +866,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -706,7 +874,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/apiref.html b/docs/manual/apiref.html index 5737c51..cf1a137 100644 --- a/docs/manual/apiref.html +++ b/docs/manual/apiref.html @@ -4,15 +4,15 @@ <title>API Reference</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="changes.html" title="Changelog"> <link rel="next" href="toc.html" title="Table of Contents"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -60,6 +60,18 @@ <li class="listitem"> <code class="computeroutput"><span class="preprocessor">#define</span> </code><a class="link" href="install.html#PUGIXML_FUNCTION">PUGIXML_FUNCTION</a> </li> +<li class="listitem"> + <code class="computeroutput"><span class="preprocessor">#define</span> </code><a class="link" href="install.html#PUGIXML_MEMORY_PAGE_SIZE">PUGIXML_MEMORY_PAGE_SIZE</a> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="preprocessor">#define</span> </code><a class="link" href="install.html#PUGIXML_MEMORY_OUTPUT_STACK">PUGIXML_MEMORY_OUTPUT_STACK</a> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="preprocessor">#define</span> </code><a class="link" href="install.html#PUGIXML_MEMORY_XPATH_PAGE_SIZE">PUGIXML_MEMORY_XPATH_PAGE_SIZE</a> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="preprocessor">#define</span> </code><a class="link" href="install.html#PUGIXML_HEADER_ONLY">PUGIXML_HEADER_ONLY</a> + </li> </ul></div> <p> Types: @@ -199,7 +211,10 @@ <a class="link" href="loading.html#encoding_utf32">encoding_utf32</a> </li> <li class="listitem"> - <a class="link" href="loading.html#encoding_wchar">encoding_wchar</a> <br><br> + <a class="link" href="loading.html#encoding_wchar">encoding_wchar</a> + </li> +<li class="listitem"> + <a class="link" href="loading.html#encoding_latin1">encoding_latin1</a> <br><br> </li> </ul></div> @@ -242,9 +257,15 @@ <a class="link" href="saving.html#format_no_declaration">format_no_declaration</a> </li> <li class="listitem"> + <a class="link" href="saving.html#format_no_escapes">format_no_escapes</a> + </li> +<li class="listitem"> <a class="link" href="saving.html#format_raw">format_raw</a> </li> <li class="listitem"> + <a class="link" href="saving.html#format_save_file_text">format_save_file_text</a> + </li> +<li class="listitem"> <a class="link" href="saving.html#format_write_bom">format_write_bom</a> <br><br> </li> @@ -287,6 +308,9 @@ <a class="link" href="loading.html#parse_ws_pcdata">parse_ws_pcdata</a> </li> <li class="listitem"> + <a class="link" href="loading.html#parse_ws_pcdata_single">parse_ws_pcdata_single</a> + </li> +<li class="listitem"> <a class="link" href="loading.html#parse_wconv_attribute">parse_wconv_attribute</a> </li> <li class="listitem"> @@ -364,20 +388,38 @@ </li> <li class="listitem"> - <code class="computeroutput"><span class="keyword">int</span> </code><a class="link" href="access.html#xml_attribute::as_int">as_int</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> + <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> </code><a class="link" href="access.html#xml_attribute::as_string">as_string</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> + <span class="identifier">def</span> <span class="special">=</span> + <span class="string">""</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">int</span> </code><a class="link" href="access.html#xml_attribute::as_int">as_int</a><code class="computeroutput"><span class="special">(</span><span class="keyword">int</span> <span class="identifier">def</span> <span class="special">=</span> + <span class="number">0</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">unsigned</span> <span class="keyword">int</span> - </code><a class="link" href="access.html#xml_attribute::as_uint">as_uint</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> + </code><a class="link" href="access.html#xml_attribute::as_uint">as_uint</a><code class="computeroutput"><span class="special">(</span><span class="keyword">unsigned</span> + <span class="keyword">int</span> <span class="identifier">def</span> + <span class="special">=</span> <span class="number">0</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">double</span> </code><a class="link" href="access.html#xml_attribute::as_double">as_double</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> + <code class="computeroutput"><span class="keyword">double</span> </code><a class="link" href="access.html#xml_attribute::as_double">as_double</a><code class="computeroutput"><span class="special">(</span><span class="keyword">double</span> + <span class="identifier">def</span> <span class="special">=</span> + <span class="number">0</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">float</span> </code><a class="link" href="access.html#xml_attribute::as_float">as_float</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> + <code class="computeroutput"><span class="keyword">float</span> </code><a class="link" href="access.html#xml_attribute::as_float">as_float</a><code class="computeroutput"><span class="special">(</span><span class="keyword">float</span> <span class="identifier">def</span> <span class="special">=</span> + <span class="number">0</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="access.html#xml_attribute::as_bool">as_bool</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> <br><br> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="access.html#xml_attribute::as_bool">as_bool</a><code class="computeroutput"><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">def</span> <span class="special">=</span> + <span class="keyword">false</span><span class="special">)</span> + <span class="keyword">const</span><span class="special">;</span></code> + <br><br> </li> <li class="listitem"> @@ -519,6 +561,18 @@ </li> <li class="listitem"> + <span class="emphasis"><em>implementation-defined type</em></span> <a class="link" href="access.html#xml_node::children">children</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> + </li> +<li class="listitem"> + <span class="emphasis"><em>implementation-defined type</em></span> <a class="link" href="access.html#xml_node::children">children</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> + <span class="identifier">name</span><span class="special">)</span> + <span class="keyword">const</span><span class="special">;</span></code> + </li> +<li class="listitem"> + <span class="emphasis"><em>implementation-defined type</em></span> <a class="link" href="access.html#xml_node::attributes">attributes</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> <br><br> + + </li> +<li class="listitem"> <code class="computeroutput"><span class="identifier">xml_node</span> </code><a class="link" href="access.html#xml_node::child">child</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">name</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code> @@ -557,7 +611,9 @@ <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> </code><a class="link" href="access.html#xml_node::child_value">child_value</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">name</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code> - <br><br> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_text</span> </code><a class="link" href="access.html#xml_node::text">text</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> <br><br> </li> <li class="listitem"> @@ -1024,6 +1080,108 @@ </ul></div> </li> <li class="listitem"> + <code class="computeroutput"><span class="keyword">class</span> </code><a class="link" href="access.html#xml_text">xml_text</a> + <div class="itemizedlist"><ul class="itemizedlist" type="circle"> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="access.html#xml_text::empty">empty</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">operator</span> </code><a class="link" href="access.html#xml_text::unspecified_bool_type">xml_text::unspecified_bool_type</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> </code><a class="link" href="access.html#xml_text::get">xml_text::get</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> </code><a class="link" href="access.html#xml_text::as_string">as_string</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> + <span class="identifier">def</span> <span class="special">=</span> + <span class="string">""</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">int</span> </code><a class="link" href="access.html#xml_text::as_int">as_int</a><code class="computeroutput"><span class="special">(</span><span class="keyword">int</span> <span class="identifier">def</span> <span class="special">=</span> + <span class="number">0</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">unsigned</span> <span class="keyword">int</span> + </code><a class="link" href="access.html#xml_text::as_uint">as_uint</a><code class="computeroutput"><span class="special">(</span><span class="keyword">unsigned</span> + <span class="keyword">int</span> <span class="identifier">def</span> + <span class="special">=</span> <span class="number">0</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">double</span> </code><a class="link" href="access.html#xml_text::as_double">as_double</a><code class="computeroutput"><span class="special">(</span><span class="keyword">double</span> + <span class="identifier">def</span> <span class="special">=</span> + <span class="number">0</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">float</span> </code><a class="link" href="access.html#xml_text::as_float">as_float</a><code class="computeroutput"><span class="special">(</span><span class="keyword">float</span> <span class="identifier">def</span> <span class="special">=</span> + <span class="number">0</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="access.html#xml_text::as_bool">as_bool</a><code class="computeroutput"><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">def</span> <span class="special">=</span> + <span class="keyword">false</span><span class="special">)</span> + <span class="keyword">const</span><span class="special">;</span></code> + <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="modify.html#xml_text::set">set</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> + <span class="identifier">rhs</span><span class="special">);</span></code> + <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="modify.html#xml_text::set">set</a><code class="computeroutput"><span class="special">(</span><span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="modify.html#xml_text::set">set</a><code class="computeroutput"><span class="special">(</span><span class="keyword">unsigned</span> + <span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="modify.html#xml_text::set">set</a><code class="computeroutput"><span class="special">(</span><span class="keyword">double</span> + <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="keyword">bool</span> </code><a class="link" href="modify.html#xml_text::set">set</a><code class="computeroutput"><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">rhs</span><span class="special">);</span></code> + <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_text</span><span class="special">&</span> + </code><a class="link" href="modify.html#xml_text::assign">operator=</a><code class="computeroutput"><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> + <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_text</span><span class="special">&</span> + </code><a class="link" href="modify.html#xml_text::assign">operator=</a><code class="computeroutput"><span class="special">(</span><span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_text</span><span class="special">&</span> + </code><a class="link" href="modify.html#xml_text::assign">operator=</a><code class="computeroutput"><span class="special">(</span><span class="keyword">unsigned</span> + <span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_text</span><span class="special">&</span> + </code><a class="link" href="modify.html#xml_text::assign">operator=</a><code class="computeroutput"><span class="special">(</span><span class="keyword">double</span> + <span class="identifier">rhs</span><span class="special">);</span></code> + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_text</span><span class="special">&</span> + </code><a class="link" href="modify.html#xml_text::assign">operator=</a><code class="computeroutput"><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">rhs</span><span class="special">);</span></code> + <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">xml_node</span> </code><a class="link" href="access.html#xml_text::data">data</a><code class="computeroutput"><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span></code> <br><br> + + </li> +</ul></div> + </li> +<li class="listitem"> <code class="computeroutput"><span class="keyword">class</span> </code><a class="link" href="saving.html#xml_writer">xml_writer</a> <div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"> <code class="computeroutput"><span class="keyword">virtual</span> <span class="keyword">void</span> @@ -1371,7 +1529,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -1379,7 +1537,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/changes.html b/docs/manual/changes.html index 78cde23..d119532 100644 --- a/docs/manual/changes.html +++ b/docs/manual/changes.html @@ -4,15 +4,15 @@ <title>Changelog</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="xpath.html" title="XPath"> <link rel="next" href="apiref.html" title="API Reference"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -30,6 +30,100 @@ <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="manual.changes"></a><a class="link" href="changes.html" title="Changelog"> Changelog</a> </h2></div></div></div> +<a name="manual.changes.1_05_2012___version_1_2"></a><h6> + <a class="link" href="changes.html#manual.changes.1_05_2012___version_1_2">1.05.2012 - version + 1.2</a> + </h6> +<p> + Major release, featuring header-only mode, various interface enhancements (i.e. + PCDATA manipulation and C++11 iteration), many other features and compatibility + improvements. + </p> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem"> + New features: + <div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem"> + Added xml_text helper class for working with PCDATA/CDATA contents + of an element node + </li> +<li class="listitem"> + Added optional header-only mode (controlled by PUGIXML_HEADER_ONLY + define) + </li> +<li class="listitem"> + Added xml_node::children() and xml_node::attributes() for C++11 ranged + for loop or BOOST_FOREACH + </li> +<li class="listitem"> + Added support for Latin-1 (ISO-8859-1) encoding conversion during + loading and saving + </li> +<li class="listitem"> + Added custom default values for xml_attribute::as_* (they are returned if the attribute + does not exist) + </li> +<li class="listitem"> + Added parse_ws_pcdata_single flag for preserving whitespace-only + PCDATA in case it's the only child + </li> +<li class="listitem"> + Added format_save_file_text for xml_document::save_file to open files + as text instead of binary (changes newlines on Windows) + </li> +<li class="listitem"> + Added format_no_escapes flag to disable special symbol escaping (complements + ~parse_escapes) + </li> +<li class="listitem"> + Added support for loading document from streams that do not support + seeking + </li> +<li class="listitem"> + Added PUGIXML_MEMORY_* constants for tweaking allocation behavior (useful for embedded + systems) + </li> +<li class="listitem"> + Added PUGIXML_VERSION preprocessor define + </li> +</ol></div> + </li> +<li class="listitem"> + Compatibility improvements: + <div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem"> + Parser does not require setjmp support (improves compatibility with + some embedded platforms, enables clr:pure compilation) + </li> +<li class="listitem"> + STL forward declarations are no longer used (fixes SunCC/RWSTL compilation, + fixes clang compilation in C++11 mode) + </li> +<li class="listitem"> + Fixed AirPlay SDK, Android, Windows Mobile (WinCE) and C++/CLI compilation + </li> +<li class="listitem"> + Fixed several compilation warnings for various GCC versions, Intel + C++ compiler and Clang + </li> +</ol></div> + </li> +<li class="listitem"> + Bug fixes: + <div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem"> + Fixed unsafe bool conversion to avoid problems on C++/CLI + </li> +<li class="listitem"> + Iterator dereference operator is const now (fixes Boost filter_iterator + support) + </li> +<li class="listitem"> + xml_document::save_file now checks for file I/O errors during saving + </li> +</ol></div> + </li> +</ul></div> <a name="manual.changes.1_11_2010___version_1_0"></a><h6> <a class="link" href="changes.html#manual.changes.1_11_2010___version_1_0">1.11.2010 - version 1.0</a> @@ -760,7 +854,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -768,7 +862,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/dom.html b/docs/manual/dom.html index 22509a9..22d8d83 100644 --- a/docs/manual/dom.html +++ b/docs/manual/dom.html @@ -4,15 +4,15 @@ <title>Document object model</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="install.html" title="Installation"> <link rel="next" href="loading.html" title="Loading document"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -40,6 +40,7 @@ <dd><dl> <dt><span class="section"><a href="dom.html#manual.dom.memory.custom"> Custom memory allocation/deallocation functions</a></span></dt> +<dt><span class="section"><a href="dom.html#manual.dom.memory.tuning"> Memory consumption tuning</a></span></dt> <dt><span class="section"><a href="dom.html#manual.dom.memory.internals"> Document memory management internals</a></span></dt> </dl></dd> @@ -102,16 +103,17 @@ <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> Plain character data nodes (<a name="node_pcdata"></a><code class="literal">node_pcdata</code>) represent plain text in XML. PCDATA nodes have a value, but do not have - a name or children/attributes. Note that plain character data is not - a part of the element node but instead has its own node; for example, - an element node can have several child PCDATA nodes. The example XML - representation of text nodes is as follows: + a name or children/attributes. Note that <span class="bold"><strong>plain + character data is not a part of the element node but instead has its + own node</strong></span>; an element node can have several child PCDATA nodes. + The example XML representation of text nodes is as follows: </li></ul></div> <pre class="programlisting"><span class="special"><</span><span class="identifier">node</span><span class="special">></span> <span class="identifier">text1</span> <span class="special"><</span><span class="identifier">child</span><span class="special">/></span> <span class="identifier">text2</span> <span class="special"></</span><span class="identifier">node</span><span class="special">></span> </pre> <div class="blockquote"><blockquote class="blockquote"><p> Here <code class="computeroutput"><span class="string">"node"</span></code> element - has three children, two of which are PCDATA nodes with values <code class="computeroutput"><span class="string">"text1"</span></code> and <code class="computeroutput"><span class="string">"text2"</span></code>. + has three children, two of which are PCDATA nodes with values <code class="computeroutput"><span class="string">" text1 "</span></code> and <code class="computeroutput"><span class="string">" + text2 "</span></code>. </p></blockquote></div> <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> Character data nodes (<a name="node_cdata"></a><code class="literal">node_cdata</code>) represent @@ -617,6 +619,54 @@ </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> +<a name="manual.dom.memory.tuning"></a><a class="link" href="dom.html#manual.dom.memory.tuning" title="Memory consumption tuning"> Memory consumption tuning</a> +</h4></div></div></div> +<p> + There are several important buffering optimizations in pugixml that rely + on predefined constants. These constants have default values that were + tuned for common usage patterns; for some applications, changing these + constants might improve memory consumption or increase performance. Changing + these constants is not recommended unless their default values result in + visible problems. + </p> +<p> + These constants can be tuned via configuration defines, as discussed in + <a class="xref" href="install.html#manual.install.building.config" title="Additional configuration options"> Additional configuration + options</a>; it is recommended to set them in <code class="filename">pugiconfig.hpp</code>. + </p> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">PUGIXML_MEMORY_PAGE_SIZE</span></code> + controls the page size for document memory allocation. Memory for node/attribute + objects is allocated in pages of the specified size. The default size + is 32 Kb; for some applications the size is too large (i.e. embedded + systems with little heap space or applications that keep lots of XML + documents in memory). A minimum size of 1 Kb is recommended. <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">PUGIXML_MEMORY_OUTPUT_STACK</span></code> + controls the cumulative stack space required to output the node. Any + output operation (i.e. saving a subtree to file) uses an internal buffering + scheme for performance reasons. The default size is 10 Kb; if you're + using node output from threads with little stack space, decreasing + this value can prevent stack overflows. A minimum size of 1 Kb is recommended. + <br><br> + + </li> +<li class="listitem"> + <code class="computeroutput"><span class="identifier">PUGIXML_MEMORY_XPATH_PAGE_SIZE</span></code> + controls the page size for XPath memory allocation. Memory for XPath + query objects as well as internal memory for XPath evaluation is allocated + in pages of the specified size. The default size is 4 Kb; if you have + a lot of resident XPath query objects, you might need to decrease the + size to improve memory consumption. A minimum size of 256 bytes is + recommended. + </li> +</ul></div> +</div> +<div class="section"> +<div class="titlepage"><div><div><h4 class="title"> <a name="manual.dom.memory.internals"></a><a class="link" href="dom.html#manual.dom.memory.internals" title="Document memory management internals"> Document memory management internals</a> </h4></div></div></div> @@ -657,7 +707,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -665,7 +715,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/install.html b/docs/manual/install.html index 9809a39..df7b322 100644 --- a/docs/manual/install.html +++ b/docs/manual/install.html @@ -4,15 +4,15 @@ <title>Installation</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> -<link rel="prev" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> +<link rel="prev" href="../manual.html" title="pugixml 1.2"> <link rel="next" href="dom.html" title="Document object model"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <b>Installation</b> | Document: @@ -44,6 +44,8 @@ a standalone static library</a></span></dt> <dt><span class="section"><a href="install.html#manual.install.building.shared"> Building pugixml as a standalone shared library</a></span></dt> +<dt><span class="section"><a href="install.html#manual.install.building.header"> Using pugixml in header-only + mode</a></span></dt> <dt><span class="section"><a href="install.html#manual.install.building.config"> Additional configuration options</a></span></dt> </dl></dd> @@ -65,8 +67,8 @@ You can download the latest source distribution via one of the following links: </p> -<pre class="programlisting"><a href="http://pugixml.googlecode.com/files/pugixml-1.0.zip" target="_top">http://pugixml.googlecode.com/files/pugixml-1.0.zip</a> -<a href="http://pugixml.googlecode.com/files/pugixml-1.0.tar.gz" target="_top">http://pugixml.googlecode.com/files/pugixml-1.0.tar.gz</a> +<pre class="programlisting"><a href="http://pugixml.googlecode.com/files/pugixml-1.2.zip" target="_top">http://pugixml.googlecode.com/files/pugixml-1.2.zip</a> +<a href="http://pugixml.googlecode.com/files/pugixml-1.2.tar.gz" target="_top">http://pugixml.googlecode.com/files/pugixml-1.2.tar.gz</a> </pre> <p> The distribution contains library source, documentation (the manual you're @@ -94,7 +96,7 @@ <p> For example, to checkout the current version, you can use this command: </p> -<pre class="programlisting">svn checkout http://pugixml.googlecode.com/svn/tags/release-1.0 pugixml</pre> +<pre class="programlisting">svn checkout http://pugixml.googlecode.com/svn/tags/release-1.2 pugixml</pre> <p> To checkout the latest version, you can use this command: </p> @@ -269,6 +271,58 @@ </p></td></tr> </table></div> </div> +<a name="PUGIXML_HEADER_ONLY"></a><div class="section"> +<div class="titlepage"><div><div><h4 class="title"> +<a name="manual.install.building.header"></a><a class="link" href="install.html#manual.install.building.header" title="Using pugixml in header-only mode"> Using pugixml in header-only + mode</a> +</h4></div></div></div> +<p> + It's possible to use pugixml in header-only mode. This means that all source + code for pugixml will be included in every translation unit that includes + <code class="filename">pugixml.hpp</code>. This is how most of Boost and STL libraries work. + </p> +<p> + Note that there are advantages and drawbacks of this approach. Header mode + may improve tree traversal/modification performance (because many simple + functions will be inlined), if your compiler toolchain does not support + link-time optimization, or if you have it turned off (with link-time optimization + the performance should be similar to non-header mode). However, since compiler + now has to compile pugixml source once for each translation unit that includes + it, compilation times may increase noticeably. If you want to use pugixml + in header mode but do not need XPath support, you can consider disabling + it by using <a class="link" href="install.html#PUGIXML_NO_XPATH">PUGIXML_NO_XPATH</a> define + to improve compilation time. + </p> +<p> + Enabling header-only mode is a two-step process: + </p> +<div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem"> + You have to define <code class="computeroutput"><span class="identifier">PUGIXML_HEADER_ONLY</span></code> + </li> +<li class="listitem"> + You have to include <code class="filename">pugixml.cpp</code> whenever you include pugixml.hpp + </li> +</ol></div> +<p> + Both of these are best done via <code class="filename">pugiconfig.hpp</code> like this: + </p> +<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">PUGIXML_HEADER_ONLY</span> +<span class="preprocessor">#include</span> <span class="string">"pugixml.cpp"</span> +</pre> +<p> + Note that it is safe to compile <code class="filename">pugixml.cpp</code> if <code class="computeroutput"><span class="identifier">PUGIXML_HEADER_ONLY</span></code> + is defined - so if you want to i.e. use header-only mode only in Release + configuration, you can include pugixml.cpp in your project (see <a class="xref" href="install.html#manual.install.building.embed" title="Building pugixml as a part of another static library/executable"> Building pugixml as + a part of another static library/executable</a>), + and conditionally enable header-only mode in <code class="filename">pugiconfig.hpp</code>, i.e.: + </p> +<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">_DEBUG</span> + <span class="preprocessor">#define</span> <span class="identifier">PUGIXML_HEADER_ONLY</span> + <span class="preprocessor">#include</span> <span class="string">"pugixml.cpp"</span> +<span class="preprocessor">#endif</span> +</pre> +</div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="manual.install.building.config"></a><a class="link" href="install.html#manual.install.building.config" title="Additional configuration options"> Additional configuration @@ -337,6 +391,12 @@ the consistency rule. </p></td></tr> </table></div> +<p> + <a name="PUGIXML_MEMORY_PAGE_SIZE"></a><code class="literal">PUGIXML_MEMORY_PAGE_SIZE</code>, <a name="PUGIXML_MEMORY_OUTPUT_STACK"></a><code class="literal">PUGIXML_MEMORY_OUTPUT_STACK</code> + and <a name="PUGIXML_MEMORY_XPATH_PAGE_SIZE"></a><code class="literal">PUGIXML_MEMORY_XPATH_PAGE_SIZE</code> + can be used to customize certain important sizes to optimize memory usage + for the application-specific patterns. For details see <a class="xref" href="dom.html#manual.dom.memory.tuning" title="Memory consumption tuning"> Memory consumption tuning</a>. + </p> </div> </div> <div class="section"> @@ -367,7 +427,8 @@ </li> <li class="listitem"> Microsoft Visual C++ 6.0, 7.0 (2002), 7.1 (2003), 8.0 (2005) x86/x64, - 9.0 (2008) x86/x64, 10.0 (2010) x86/x64 + 9.0 (2008) x86/x64, 10.0 (2010) x86/x64, 11.0 x86/x64/ARM and some + CLR versions </li> <li class="listitem"> MinGW (GCC) 3.4, 4.4, 4.5, 4.6 x64 @@ -384,6 +445,9 @@ Apple MacOSX (GCC 4.0.1 x86/x64/PowerPC) </li> <li class="listitem"> + Sun Solaris (sunCC x86/x64) + </li> +<li class="listitem"> Microsoft Xbox 360 </li> <li class="listitem"> @@ -395,6 +459,10 @@ <li class="listitem"> Sony Playstation 3 (GCC 4.1.1, SNC 310.1) </li> +<li class="listitem"> + Various portable platforms (Android NDK, BlackBerry NDK, Samsung bada, + Windows CE) + </li> </ul></div> </div> <div class="footnotes"> @@ -405,7 +473,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -413,7 +481,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <b>Installation</b> | Document: diff --git a/docs/manual/loading.html b/docs/manual/loading.html index 5b5576b..a26b62c 100644 --- a/docs/manual/loading.html +++ b/docs/manual/loading.html @@ -4,15 +4,15 @@ <title>Loading document</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="dom.html" title="Document object model"> <link rel="next" href="access.html" title="Accessing document data"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -282,10 +282,6 @@ </pre> <p> </p> -<p> - Stream loading requires working seek/tell functions and therefore may fail - when used with some stream implementations like gzstream. - </p> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> @@ -384,7 +380,9 @@ returned by <code class="computeroutput"><span class="identifier">description</span><span class="special">()</span></code> function may change from version to version, so any complex status handling should be based on <code class="computeroutput"><span class="identifier">status</span></code> - value. + value. Note that <code class="computeroutput"><span class="identifier">description</span><span class="special">()</span></code> returns a <code class="computeroutput"><span class="keyword">char</span></code> + string even in <code class="computeroutput"><span class="identifier">PUGIXML_WCHAR_MODE</span></code>; + you'll have to call <a class="link" href="dom.html#as_wide">as_wide</a> to get the <code class="computeroutput"><span class="keyword">wchar_t</span></code> string. </p> <p> If parsing failed because the source data was not a valid XML, the resulting @@ -533,6 +531,25 @@ <code class="computeroutput"><span class="string">" "</span></code>), and only one child when <code class="computeroutput"><span class="identifier">parse_ws_pcdata</span></code> is not set. This flag is <span class="bold"><strong>off</strong></span> by default. + <br><br> + + </li> +<li class="listitem"> + <a name="parse_ws_pcdata_single"></a><code class="literal">parse_ws_pcdata_single</code> determines + if whitespace-only PCDATA nodes that have no sibling nodes are to be + put in DOM tree. In some cases application needs to parse the whitespace-only + contents of nodes, i.e. <code class="computeroutput"><span class="special"><</span><span class="identifier">node</span><span class="special">></span> + <span class="special"></</span><span class="identifier">node</span><span class="special">></span></code>, but is not interested in whitespace + markup elsewhere. It is possible to use <a class="link" href="loading.html#parse_ws_pcdata">parse_ws_pcdata</a> + flag in this case, but it results in excessive allocations and complicates + document processing in some cases; this flag is intended to avoid that. + As an example, after parsing XML string <code class="computeroutput"><span class="special"><</span><span class="identifier">node</span><span class="special">></span> + <span class="special"><</span><span class="identifier">a</span><span class="special">></span> <span class="special"></</span><span class="identifier">a</span><span class="special">></span> <span class="special"></</span><span class="identifier">node</span><span class="special">></span></code> with <code class="computeroutput"><span class="identifier">parse_ws_pcdata_single</span></code> + flag set, <code class="computeroutput"><span class="special"><</span><span class="identifier">node</span><span class="special">></span></code> element will have one child <code class="computeroutput"><span class="special"><</span><span class="identifier">a</span><span class="special">></span></code>, and <code class="computeroutput"><span class="special"><</span><span class="identifier">a</span><span class="special">></span></code> + element will have one child with type <a class="link" href="dom.html#node_pcdata">node_pcdata</a> + and value <code class="computeroutput"><span class="string">" "</span></code>. + This flag has no effect if <a class="link" href="loading.html#parse_ws_pcdata">parse_ws_pcdata</a> + is enabled. This flag is <span class="bold"><strong>off</strong></span> by default. </li> </ul></div> <p> @@ -581,8 +598,7 @@ attributes. This means, that after attribute values are normalized as if <a class="link" href="loading.html#parse_wconv_attribute">parse_wconv_attribute</a> was set, leading and trailing space characters are removed, and all sequences - of space characters are replaced by a single space character. The value - of <a class="link" href="loading.html#parse_wconv_attribute">parse_wconv_attribute</a> + of space characters are replaced by a single space character. <a class="link" href="loading.html#parse_wconv_attribute">parse_wconv_attribute</a> has no effect if this flag is on. This flag is <span class="bold"><strong>off</strong></span> by default. </li> @@ -755,6 +771,10 @@ or <code class="computeroutput"><span class="identifier">encoding_utf32</span></code>, depending on <code class="computeroutput"><span class="keyword">wchar_t</span></code> size. </li> +<li class="listitem"> + <a name="encoding_latin1"></a><code class="literal">encoding_latin1</code> corresponds to ISO-8859-1 + encoding (also known as Latin-1). + </li> </ul></div> <p> The algorithm used for <code class="computeroutput"><span class="identifier">encoding_auto</span></code> @@ -828,7 +848,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -836,7 +856,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/modify.html b/docs/manual/modify.html index 3db02e1..b039dc7 100644 --- a/docs/manual/modify.html +++ b/docs/manual/modify.html @@ -4,15 +4,15 @@ <title>Modifying document data</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="access.html" title="Accessing document data"> <link rel="next" href="saving.html" title="Saving document"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -35,6 +35,7 @@ <dt><span class="section"><a href="modify.html#manual.modify.attrdata"> Setting attribute data</a></span></dt> <dt><span class="section"><a href="modify.html#manual.modify.add"> Adding nodes/attributes</a></span></dt> <dt><span class="section"><a href="modify.html#manual.modify.remove"> Removing nodes/attributes</a></span></dt> +<dt><span class="section"><a href="modify.html#manual.modify.text"> Working with text contents</a></span></dt> <dt><span class="section"><a href="modify.html#manual.modify.clone"> Cloning nodes/attributes</a></span></dt> </dl></div> <p> @@ -406,6 +407,85 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> +<a name="manual.modify.text"></a><a class="link" href="modify.html#manual.modify.text" title="Working with text contents"> Working with text contents</a> +</h3></div></div></div> +<p> + pugixml provides a special class, <code class="computeroutput"><span class="identifier">xml_text</span></code>, + to work with text contents stored as a value of some node, i.e. <code class="computeroutput"><span class="special"><</span><span class="identifier">node</span><span class="special">><</span><span class="identifier">description</span><span class="special">></span><span class="identifier">This</span> <span class="identifier">is</span> <span class="identifier">a</span> <span class="identifier">node</span><span class="special"></</span><span class="identifier">description</span><span class="special">></</span><span class="identifier">node</span><span class="special">></span></code>. + Working with text objects to retrieve data is described in <a class="link" href="access.html#manual.access.text" title="Working with text contents">the + documentation for accessing document data</a>; this section describes + the modification interface of <code class="computeroutput"><span class="identifier">xml_text</span></code>. + </p> +<a name="xml_text::set"></a><p> + Once you have an <code class="computeroutput"><span class="identifier">xml_text</span></code> + object, you can set the text contents using the following function: + </p> +<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">rhs</span><span class="special">);</span> +</pre> +<p> + This function tries to set the contents to the specified string, and returns + the operation result. The operation fails if the text object was retrieved + from a node that can not have a value and that is not an element node (i.e. + it is a <a class="link" href="dom.html#node_declaration">node_declaration</a> node), if + the text object is empty, or if there is insufficient memory to handle the + request. The provided string is copied into document managed memory and can + be destroyed after the function returns (for example, you can safely pass + stack-allocated buffers to this function). Note that if the text object was + retrieved from an element node, this function creates the PCDATA child node + if necessary (i.e. if the element node does not have a PCDATA/CDATA child + already). + </p> +<a name="xml_text::set_value"></a><p> + In addition to a string function, several functions are provided for handling + text with numbers and booleans as contents: + </p> +<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="keyword">bool</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="identifier">set</span><span class="special">(</span><span class="keyword">bool</span> <span class="identifier">rhs</span><span class="special">);</span> +</pre> +<p> + The above functions convert the argument to string and then call the base + <code class="computeroutput"><span class="identifier">set</span></code> function. These functions + have the same semantics as similar <code class="computeroutput"><span class="identifier">xml_attribute</span></code> + functions. You can <a class="link" href="modify.html#xml_attribute::set_value">refer to documentation + for the attribute functions</a> for details. + </p> +<a name="xml_text::assign"></a><p> + For convenience, all <code class="computeroutput"><span class="identifier">set</span></code> + functions have the corresponding assignment operators: + </p> +<pre class="programlisting"><span class="identifier">xml_text</span><span class="special">&</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">char_t</span><span class="special">*</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="identifier">xml_text</span><span class="special">&</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="identifier">xml_text</span><span class="special">&</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="identifier">xml_text</span><span class="special">&</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">double</span> <span class="identifier">rhs</span><span class="special">);</span> +<span class="identifier">xml_text</span><span class="special">&</span> <span class="identifier">xml_text</span><span class="special">::</span><span class="keyword">operator</span><span class="special">=(</span><span class="keyword">bool</span> <span class="identifier">rhs</span><span class="special">);</span> +</pre> +<p> + These operators simply call the right <code class="computeroutput"><span class="identifier">set</span></code> + function and return the attribute they're called on; the return value of + <code class="computeroutput"><span class="identifier">set</span></code> is ignored, so errors + are ignored. + </p> +<p> + This is an example of using <code class="computeroutput"><span class="identifier">xml_text</span></code> + object to modify text contents (<a href="../samples/text.cpp" target="_top">samples/text.cpp</a>): + </p> +<p> + +</p> +<pre class="programlisting"><span class="comment">// change project version +</span><span class="identifier">project</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"version"</span><span class="special">).</span><span class="identifier">text</span><span class="special">()</span> <span class="special">=</span> <span class="number">1.2</span><span class="special">;</span> + +<span class="comment">// add description element and set the contents +</span><span class="comment">// note that we do not have to explicitly add the node_pcdata child +</span><span class="identifier">project</span><span class="special">.</span><span class="identifier">append_child</span><span class="special">(</span><span class="string">"description"</span><span class="special">).</span><span class="identifier">text</span><span class="special">().</span><span class="identifier">set</span><span class="special">(</span><span class="string">"a test project"</span><span class="special">);</span> +</pre> +<p> + </p> +</div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> <a name="manual.modify.clone"></a><a class="link" href="modify.html#manual.modify.clone" title="Cloning nodes/attributes"> Cloning nodes/attributes</a> </h3></div></div></div> <a name="xml_node::prepend_copy"></a><a name="xml_node::append_copy"></a><a name="xml_node::insert_copy_after"></a><a name="xml_node::insert_copy_before"></a><p> @@ -528,7 +608,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -536,7 +616,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/saving.html b/docs/manual/saving.html index abaf9f2..2be70cb 100644 --- a/docs/manual/saving.html +++ b/docs/manual/saving.html @@ -4,15 +4,15 @@ <title>Saving document</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="modify.html" title="Modifying document data"> <link rel="next" href="xpath.html" title="XPath"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -37,6 +37,7 @@ <dt><span class="section"><a href="saving.html#manual.saving.subtree"> Saving a single subtree</a></span></dt> <dt><span class="section"><a href="saving.html#manual.saving.options"> Output options</a></span></dt> <dt><span class="section"><a href="saving.html#manual.saving.encoding"> Encodings</a></span></dt> +<dt><span class="section"><a href="saving.html#manual.saving.declaration"> Customizing document declaration</a></span></dt> </dl></div> <p> Often after creating a new document or loading the existing one and processing @@ -52,8 +53,9 @@ <p> Before writing to the destination the node/attribute data is properly formatted according to the node type; all special XML symbols, such as < and &, - are properly escaped. In order to guard against forgotten node/attribute names, - empty node/attribute names are printed as <code class="computeroutput"><span class="string">":anonymous"</span></code>. + are properly escaped (unless <a class="link" href="saving.html#format_no_escapes">format_no_escapes</a> + flag is set). In order to guard against forgotten node/attribute names, empty + node/attribute names are printed as <code class="computeroutput"><span class="string">":anonymous"</span></code>. For well-formed output, make sure all node and attribute names are set to meaningful values. </p> @@ -179,11 +181,11 @@ </pre> <p> In order to output the document via some custom transport, for example sockets, - you should create an object which implements <code class="computeroutput"><span class="identifier">xml_writer_file</span></code> + you should create an object which implements <code class="computeroutput"><span class="identifier">xml_writer</span></code> interface and pass it to <code class="computeroutput"><span class="identifier">save</span></code> - function. <code class="computeroutput"><span class="identifier">xml_writer_file</span><span class="special">::</span><span class="identifier">write</span></code> - function is called with a buffer as an input, where <code class="computeroutput"><span class="identifier">data</span></code> - points to buffer start, and <code class="computeroutput"><span class="identifier">size</span></code> + function. <code class="computeroutput"><span class="identifier">xml_writer</span><span class="special">::</span><span class="identifier">write</span></code> function is called with a buffer + as an input, where <code class="computeroutput"><span class="identifier">data</span></code> points + to buffer start, and <code class="computeroutput"><span class="identifier">size</span></code> is equal to the buffer size in bytes. <code class="computeroutput"><span class="identifier">write</span></code> implementation must write the buffer to the transport; it can not save the passed buffer pointer, as the buffer contents will change after <code class="computeroutput"><span class="identifier">write</span></code> returns. The buffer contains the @@ -192,9 +194,8 @@ <p> <code class="computeroutput"><span class="identifier">write</span></code> function is called with relatively large blocks (size is usually several kilobytes, except for - the first block with BOM, which is output only if <a class="link" href="saving.html#format_write_bom">format_write_bom</a> - is set, and last block, which may be small), so there is often no need for - additional buffering in the implementation. + the last block that may be small), so there is often no need for additional + buffering in the implementation. </p> <p> This is a simple example of custom writer for saving document data to STL @@ -310,7 +311,19 @@ to be read by humans; also it can be useful if the document was parsed with <a class="link" href="loading.html#parse_ws_pcdata">parse_ws_pcdata</a> flag, to preserve the original document formatting as much as possible. This flag - is <span class="bold"><strong>off</strong></span> by default. + is <span class="bold"><strong>off</strong></span> by default. <br><br> + + </li> +<li class="listitem"> + <a name="format_no_escapes"></a><code class="literal">format_no_escapes</code> disables output + escaping for attribute values and PCDATA contents. If this flag is on, + special symbols (', &, <, >) and all non-printable characters + (those with codepoint values less than 32) are converted to XML escape + sequences (i.e. &amp;) during output. If this flag is off, no text + processing is performed; therefore, output XML can be malformed if output + contents contains invalid symbols (i.e. having a stray < in the PCDATA + will make the output malformed). This flag is <span class="bold"><strong>on</strong></span> + by default. </li> </ul></div> <p> @@ -337,6 +350,16 @@ functions: they never output the BOM. This flag is <span class="bold"><strong>off</strong></span> by default. </li> +<li class="listitem"> + <a name="format_save_file_text"></a><code class="literal">format_save_file_text</code> changes + the file mode when using <code class="computeroutput"><span class="identifier">save_file</span></code> + function. By default, file is opened in binary mode, which means that + the output file will contain platform-independent newline \n (ASCII 10). + If this flag is on, file is opened in text mode, which on some systems + changes the newline format (i.e. on Windows you can use this flag to + output XML documents with \r\n (ASCII 13 10) newlines. This flag is + <span class="bold"><strong>off</strong></span> by default. + </li> </ul></div> <p> Additionally, there is one predefined option mask: @@ -435,10 +458,67 @@ </p></td></tr> </table></div> </div> +<div class="section"> +<div class="titlepage"><div><div><h3 class="title"> +<a name="manual.saving.declaration"></a><a class="link" href="saving.html#manual.saving.declaration" title="Customizing document declaration"> Customizing document declaration</a> +</h3></div></div></div> +<p> + When you are saving the document using <code class="computeroutput"><span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">save</span><span class="special">()</span></code> or <code class="computeroutput"><span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">save_file</span><span class="special">()</span></code>, a default XML document declaration is + output, if <code class="computeroutput"><span class="identifier">format_no_declaration</span></code> + is not speficied and if the document does not have a declaration node. However, + the default declaration is not customizable. If you want to customize the + declaration output, you need to create the declaration node yourself. + </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> + By default the declaration node is not added to the document during parsing. + If you just need to preserve the original declaration node, you have to + add the flag <a class="link" href="loading.html#parse_declaration">parse_declaration</a> + to the parsing flags; the resulting document will contain the original + declaration node, which will be output during saving. + </p></td></tr> +</table></div> +<p> + Declaration node is a node with type <a class="link" href="dom.html#node_declaration">node_declaration</a>; + it behaves like an element node in that it has attributes with values (but + it does not have child nodes). Therefore setting custom version, encoding + or standalone declaration involves adding attributes and setting attribute + values. + </p> +<p> + This is an example that shows how to create a custom declaration node (<a href="../samples/save_declaration.cpp" target="_top">samples/save_declaration.cpp</a>): + </p> +<p> + +</p> +<pre class="programlisting"><span class="comment">// get a test document +</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_document</span> <span class="identifier">doc</span><span class="special">;</span> +<span class="identifier">doc</span><span class="special">.</span><span class="identifier">load</span><span class="special">(</span><span class="string">"<foo bar='baz'><call>hey</call></foo>"</span><span class="special">);</span> + +<span class="comment">// add a custom declaration node +</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">decl</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">prepend_child</span><span class="special">(</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">node_declaration</span><span class="special">);</span> +<span class="identifier">decl</span><span class="special">.</span><span class="identifier">append_attribute</span><span class="special">(</span><span class="string">"version"</span><span class="special">)</span> <span class="special">=</span> <span class="string">"1.0"</span><span class="special">;</span> +<span class="identifier">decl</span><span class="special">.</span><span class="identifier">append_attribute</span><span class="special">(</span><span class="string">"encoding"</span><span class="special">)</span> <span class="special">=</span> <span class="string">"UTF-8"</span><span class="special">;</span> +<span class="identifier">decl</span><span class="special">.</span><span class="identifier">append_attribute</span><span class="special">(</span><span class="string">"standalone"</span><span class="special">)</span> <span class="special">=</span> <span class="string">"no"</span><span class="special">;</span> + +<span class="comment">// <?xml version="1.0" encoding="UTF-8" standalone="no"?> +</span><span class="comment">// <foo bar="baz"> +</span><span class="comment">// <call>hey</call> +</span><span class="comment">// </foo> +</span><span class="identifier">doc</span><span class="special">.</span><span class="identifier">save</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">);</span> +<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +</pre> +<p> + </p> +</div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -446,7 +526,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/toc.html b/docs/manual/toc.html index 97d0b6c..d9fe5f8 100644 --- a/docs/manual/toc.html +++ b/docs/manual/toc.html @@ -4,14 +4,14 @@ <title>Table of Contents</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="apiref.html" title="API Reference"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -52,6 +52,8 @@ a standalone static library</a></span></dt> <dt><span class="section"><a href="install.html#manual.install.building.shared"> Building pugixml as a standalone shared library</a></span></dt> +<dt><span class="section"><a href="install.html#manual.install.building.header"> Using pugixml in header-only + mode</a></span></dt> <dt><span class="section"><a href="install.html#manual.install.building.config"> Additional configuration options</a></span></dt> </dl></dd> @@ -68,6 +70,7 @@ <dd><dl> <dt><span class="section"><a href="dom.html#manual.dom.memory.custom"> Custom memory allocation/deallocation functions</a></span></dt> +<dt><span class="section"><a href="dom.html#manual.dom.memory.tuning"> Memory consumption tuning</a></span></dt> <dt><span class="section"><a href="dom.html#manual.dom.memory.internals"> Document memory management internals</a></span></dt> </dl></dd> @@ -88,11 +91,13 @@ <dt><span class="section"><a href="access.html#manual.access.nodedata"> Getting node data</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.attrdata"> Getting attribute data</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.contents"> Contents-based traversal functions</a></span></dt> +<dt><span class="section"><a href="access.html#manual.access.rangefor"> Range-based for-loop support</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.iterators"> Traversing node/attribute lists via iterators</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.walker"> Recursive traversal with xml_tree_walker</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.predicate"> Searching for nodes/attributes with predicates</a></span></dt> +<dt><span class="section"><a href="access.html#manual.access.text"> Working with text contents</a></span></dt> <dt><span class="section"><a href="access.html#manual.access.misc"> Miscellaneous functions</a></span></dt> </dl></dd> <dt><span class="section"><a href="modify.html"> Modifying document data</a></span></dt> @@ -101,6 +106,7 @@ <dt><span class="section"><a href="modify.html#manual.modify.attrdata"> Setting attribute data</a></span></dt> <dt><span class="section"><a href="modify.html#manual.modify.add"> Adding nodes/attributes</a></span></dt> <dt><span class="section"><a href="modify.html#manual.modify.remove"> Removing nodes/attributes</a></span></dt> +<dt><span class="section"><a href="modify.html#manual.modify.text"> Working with text contents</a></span></dt> <dt><span class="section"><a href="modify.html#manual.modify.clone"> Cloning nodes/attributes</a></span></dt> </dl></dd> <dt><span class="section"><a href="saving.html"> Saving document</a></span></dt> @@ -111,6 +117,7 @@ <dt><span class="section"><a href="saving.html#manual.saving.subtree"> Saving a single subtree</a></span></dt> <dt><span class="section"><a href="saving.html#manual.saving.options"> Output options</a></span></dt> <dt><span class="section"><a href="saving.html#manual.saving.encoding"> Encodings</a></span></dt> +<dt><span class="section"><a href="saving.html#manual.saving.declaration"> Customizing document declaration</a></span></dt> </dl></dd> <dt><span class="section"><a href="xpath.html"> XPath</a></span></dt> <dd><dl> @@ -128,7 +135,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -136,7 +143,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: diff --git a/docs/manual/xpath.html b/docs/manual/xpath.html index ea6b956..bb37f64 100644 --- a/docs/manual/xpath.html +++ b/docs/manual/xpath.html @@ -4,15 +4,15 @@ <title>XPath</title> <link rel="stylesheet" href="../pugixml.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="../manual.html" title="pugixml 1.0"> -<link rel="up" href="../manual.html" title="pugixml 1.0"> +<link rel="home" href="../manual.html" title="pugixml 1.2"> +<link rel="up" href="../manual.html" title="pugixml 1.2"> <link rel="prev" href="saving.html" title="Saving document"> <link rel="next" href="changes.html" title="Changelog"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: @@ -624,7 +624,11 @@ <a name="xpath_parse_result::description"></a><p> <code class="computeroutput"><span class="identifier">description</span><span class="special">()</span></code> member function can be used to get the error message; it never returns the - null pointer, so you can safely use description() even if query parsing succeeded. + null pointer, so you can safely use <code class="computeroutput"><span class="identifier">description</span><span class="special">()</span></code> even if query parsing succeeded. Note that + <code class="computeroutput"><span class="identifier">description</span><span class="special">()</span></code> + returns a <code class="computeroutput"><span class="keyword">char</span></code> string even in + <code class="computeroutput"><span class="identifier">PUGIXML_WCHAR_MODE</span></code>; you'll + have to call <a class="link" href="dom.html#as_wide">as_wide</a> to get the <code class="computeroutput"><span class="keyword">wchar_t</span></code> string. </p> <a name="xpath_parse_result::offset"></a><p> In addition to the error message, parsing result has an <code class="computeroutput"><span class="identifier">offset</span></code> @@ -717,7 +721,7 @@ </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> -<td align="right"><div class="copyright-footer">Copyright © 2010 Arseny Kapoulkine<p> +<td align="right"><div class="copyright-footer">Copyright © 2012 Arseny Kapoulkine<p> Distributed under the MIT License </p> </div></td> @@ -725,7 +729,7 @@ <hr> <table width="100%"><tr> <td> -<a href="http://pugixml.org/">pugixml 1.0</a> manual | +<a href="http://pugixml.org/">pugixml 1.2</a> manual | <a href="../manual.html">Overview</a> | <a href="install.html">Installation</a> | Document: |