diff options
author | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-04-29 22:51:21 +0000 |
---|---|---|
committer | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-04-29 22:51:21 +0000 |
commit | 7e7153457722ff2272bf094cca5387bd2e2ebd71 (patch) | |
tree | 3161538e774cfb9791d4131aa70e858333e1a682 /docs | |
parent | a1f4ff0467d8d97077c29738871df5984ce3e3ae (diff) |
docs: Regenerated HTML documentation
git-svn-id: http://pugixml.googlecode.com/svn/trunk@908 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'docs')
-rw-r--r-- | docs/manual.html | 14 | ||||
-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 | ||||
-rw-r--r-- | docs/quickstart.html | 567 |
12 files changed, 1017 insertions, 493 deletions
diff --git a/docs/manual.html b/docs/manual.html index 2218160..66efba2 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -1,16 +1,16 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> -<title>pugixml 1.0</title> +<title>pugixml 1.2</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="home" href="manual.html" title="pugixml 1.2"> <link rel="next" href="manual/install.html" title="Installation"> </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 | <b>Overview</b> | <a href="manual/install.html">Installation</a> | Document: @@ -147,7 +147,7 @@ </p> <div class="blockquote"><blockquote class="blockquote"> <p> - Copyright (c) 2006-2010 Arseny Kapoulkine + Copyright (c) 2006-2012 Arseny Kapoulkine </p> <p> Permission is hereby granted, free of charge, to any person obtaining a @@ -179,18 +179,18 @@ <div class="blockquote"><blockquote class="blockquote"><p> This software is based on pugixml library (http://pugixml.org).<br> pugixml - is Copyright (C) 2006-2010 Arseny Kapoulkine. + is Copyright (C) 2006-2012 Arseny Kapoulkine. </p></blockquote></div> </div> </div></div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> -<td align="left"><p><small>Last revised: October 31, 2010 at 17:44:02 GMT</small></p></td> +<td align="left"><p><small>Last revised: April 29, 2012 at 22:49:51 GMT</small></p></td> <td align="right"><div class="copyright-footer"></div></td> </tr></table> <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 | <b>Overview</b> | <a href="manual/install.html">Installation</a> | Document: 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: diff --git a/docs/quickstart.html b/docs/quickstart.html index d39e552..75a2b1e 100644 --- a/docs/quickstart.html +++ b/docs/quickstart.html @@ -1,34 +1,5 @@ -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> -<title>pugixml 1.0</title> -<link rel="stylesheet" href="pugixml.css" type="text/css"> -<meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> -<link rel="home" href="quickstart.html" title="pugixml 1.0"> -</head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> -<div class="article"> -<div class="section"> -<div class="titlepage"><div><div><h2 class="title" style="clear: both"> -<a name="quickstart.main"></a><a class="link" href="quickstart.html#quickstart.main" title="pugixml 1.0 quick start guide"> pugixml 1.0 quick start guide</a> -</h2></div></div></div> -<div class="toc"><dl> -<dt><span class="section"><a href="quickstart.html#quickstart.main.introduction"> Introduction</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.install"> Installation</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.dom"> Document object model</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.loading"> Loading document</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.access"> Accessing document data</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.modify"> Modifying document data</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.saving"> Saving document</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.feedback"> Feedback</a></span></dt> -<dt><span class="section"><a href="quickstart.html#quickstart.main.license"> License</a></span></dt> -</dl></div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.introduction"></a><a class="link" href="quickstart.html#quickstart.main.introduction" title="Introduction"> Introduction</a> -</h3></div></div></div> -<p> - <a href="http://pugixml.org/" target="_top">pugixml</a> is a light-weight C++ XML +<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pugixml 1.2</title><link rel="stylesheet" href="pugixml.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="quickstart.html" title="pugixml 1.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" title="pugixml 1.2"><div class="section" title="pugixml 1.2 quick start guide"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quickstart.main"></a><a class="link" href="quickstart.html#quickstart.main" title="pugixml 1.2 quick start guide"> pugixml 1.2 quick start guide</a></h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="quickstart.html#quickstart.main.introduction"> Introduction</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.install"> Installation</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.dom"> Document object model</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.loading"> Loading document</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.access"> Accessing document data</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.modify"> Modifying document data</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.saving"> Saving document</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.feedback"> Feedback</a></span></dt><dt><span class="section"><a href="quickstart.html#quickstart.main.license"> License</a></span></dt></dl></div><div class="section" title="Introduction"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.introduction"></a><a class="link" href="quickstart.html#quickstart.main.introduction" title="Introduction"> Introduction</a></h3></div></div></div><p> + <a class="ulink" href="http://pugixml.org/" target="_top">pugixml</a> is a light-weight C++ XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven @@ -39,54 +10,36 @@ and has many users. All code is distributed under the <a class="link" href="quickstart.html#quickstart.main.license" title="License">MIT license</a>, making it completely free to use in both open-source and proprietary applications. - </p> -<p> + </p><p> pugixml enables very fast, convenient and memory-efficient XML document processing. However, since pugixml has a DOM parser, it can't process XML documents that do not fit in memory; also the parser is a non-validating one, so if you need DTD/Schema validation, the library is not for you. - </p> -<p> + </p><p> This is the quick start guide for pugixml, which purpose is to enable you to start using the library quickly. Many important library features are either not described at all or only mentioned briefly; for more complete information - you <a href="manual.html" target="_top">should read the complete manual</a>. - </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> + you <a class="ulink" href="manual.html" target="_top">should read the complete manual</a>. + </p><div class="note" title="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> No documentation is perfect, neither is this one. If you encounter a description that is unclear, please file an issue as described in <a class="xref" href="quickstart.html#quickstart.main.feedback" title="Feedback"> Feedback</a>. Also if you can spare the time for a full proof-reading, including spelling and grammar, that would be great! Please <a class="link" href="quickstart.html#email">send me an e-mail</a>; as a token of appreciation, your name will be included into the corresponding section of the manual. - </p></td></tr> -</table></div> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.install"></a><a class="link" href="quickstart.html#quickstart.main.install" title="Installation"> Installation</a> -</h3></div></div></div> -<p> + </p></td></tr></table></div></div><div class="section" title="Installation"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.install"></a><a class="link" href="quickstart.html#quickstart.main.install" title="Installation"> Installation</a></h3></div></div></div><p> pugixml is distributed in source form. You can download a 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> -<p> + </p><pre class="programlisting"><a class="ulink" href="http://pugixml.googlecode.com/files/pugixml-1.2.zip" target="_top">http://pugixml.googlecode.com/files/pugixml-1.2.zip</a> +<a class="ulink" 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 guide you're reading now and the manual) and some code examples. After downloading the distribution, install pugixml by extracting all files from the compressed archive. The files have different line endings depending on the archive format - <code class="filename">.zip</code> archive has Windows line endings, <code class="filename">.tar.gz</code> archive has Unix line endings. Otherwise the files in both archives are identical. - </p> -<p> + </p><p> The complete pugixml source consists of three files - one source file, <code class="filename">pugixml.cpp</code>, and two header files, <code class="filename">pugixml.hpp</code> and <code class="filename">pugiconfig.hpp</code>. <code class="filename">pugixml.hpp</code> is the primary header which you need to include in order to use pugixml classes/functions. @@ -95,23 +48,16 @@ can find the header; however you can also use relative path (i.e. <code class="computeroutput"><span class="preprocessor">#include</span> <span class="string">"../libs/pugixml/src/pugixml.hpp"</span></code>) or include directory-relative path (i.e. <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">xml</span><span class="special">/</span><span class="identifier">thirdparty</span><span class="special">/</span><span class="identifier">pugixml</span><span class="special">/</span><span class="identifier">src</span><span class="special">/</span><span class="identifier">pugixml</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>). - </p> -<p> + </p><p> The easiest way to build pugixml is to compile the source file, <code class="filename">pugixml.cpp</code>, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio<sup>[<a name="trademarks" href="#ftn.trademarks" class="footnote">1</a>]</sup>, Apple Xcode, Code::Blocks or any other IDE, just add <code class="filename">pugixml.cpp</code> to one of your projects. There are other building methods available, including building - pugixml as a standalone static/shared library; <a href="manual/install.html#manual.install.building" target="_top">read + pugixml as a standalone static/shared library; <a class="ulink" href="manual/install.html#manual.install.building" target="_top">read the manual</a> for further information. - </p> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.dom"></a><a class="link" href="quickstart.html#quickstart.main.dom" title="Document object model"> Document object model</a> -</h3></div></div></div> -<p> + </p></div><div class="section" title="Document object model"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.dom"></a><a class="link" href="quickstart.html#quickstart.main.dom" title="Document object model"> Document object model</a></h3></div></div></div><p> pugixml stores XML data in DOM-like way: the entire XML document (both document structure and element data) is stored in memory as a tree. The tree can be loaded from character stream (file, string, C++ I/O stream), then traversed @@ -119,8 +65,7 @@ structure and node/attribute data can be changed at any time. Finally, the result of document transformations can be saved to a character stream (file, C++ I/O stream or custom transport). - </p> -<p> + </p><p> The root of the tree is the document itself, which corresponds to C++ type <code class="computeroutput"><span class="identifier">xml_document</span></code>. Document has one or more child nodes, which correspond to C++ type <code class="computeroutput"><span class="identifier">xml_node</span></code>. @@ -128,55 +73,40 @@ of child nodes, a collection of attributes, which correspond to C++ type <code class="computeroutput"><span class="identifier">xml_attribute</span></code>, and some additional data (i.e. name). - </p> -<p> + </p><p> The most common node types are: - </p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc"> -<li class="listitem"> + </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> Document node (<code class="computeroutput"><span class="identifier">node_document</span></code>) - this is the root of the tree, which consists of several child nodes. This node corresponds to <code class="computeroutput"><span class="identifier">xml_document</span></code> class; note that <code class="computeroutput"><span class="identifier">xml_document</span></code> is a sub-class of <code class="computeroutput"><span class="identifier">xml_node</span></code>, so the entire node interface is also available. - </li> -<li class="listitem"> + </li><li class="listitem"> Element/tag node (<code class="computeroutput"><span class="identifier">node_element</span></code>) - this is the most common type of node, which represents XML elements. Element nodes have a name, a collection of attributes and a collection of child nodes (both of which may be empty). The attribute is a simple name/value pair. - </li> -<li class="listitem"> + </li><li class="listitem"> Plain character data nodes (<code class="computeroutput"><span class="identifier">node_pcdata</span></code>) represent plain text in XML. PCDATA nodes have a value, but do not have - 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. - </li> -</ul></div> -<p> + 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>; + for example, an element node can have several child PCDATA nodes. + </li></ul></div><p> Despite the fact that there are several node types, there are only three C++ types representing the tree (<code class="computeroutput"><span class="identifier">xml_document</span></code>, <code class="computeroutput"><span class="identifier">xml_node</span></code>, <code class="computeroutput"><span class="identifier">xml_attribute</span></code>); some operations on <code class="computeroutput"><span class="identifier">xml_node</span></code> are only valid for certain node types. They are described below. - </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> + </p><div class="note" title="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> All pugixml classes and functions are located in <code class="computeroutput"><span class="identifier">pugi</span></code> namespace; you have to either use explicit name qualification (i.e. <code class="computeroutput"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span></code>), or to gain access to relevant symbols via <code class="computeroutput"><span class="keyword">using</span></code> directive (i.e. <code class="computeroutput"><span class="keyword">using</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span><span class="special">;</span></code> or <code class="computeroutput"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">pugi</span><span class="special">;</span></code>). - </p></td></tr> -</table></div> -<p> + </p></td></tr></table></div><p> <code class="computeroutput"><span class="identifier">xml_document</span></code> is the owner of the entire document structure; destroying the document destroys the whole tree. The interface of <code class="computeroutput"><span class="identifier">xml_document</span></code> @@ -184,16 +114,14 @@ of <code class="computeroutput"><span class="identifier">xml_node</span></code>, which allows for document inspection and/or modification. Note that while <code class="computeroutput"><span class="identifier">xml_document</span></code> is a sub-class of <code class="computeroutput"><span class="identifier">xml_node</span></code>, <code class="computeroutput"><span class="identifier">xml_node</span></code> is not a polymorphic type; the inheritance is present only to simplify usage. - </p> -<p> + </p><p> <code class="computeroutput"><span class="identifier">xml_node</span></code> is the handle to document node; it can point to any node in the document, including document itself. There is a common interface for nodes of all types. Note that <code class="computeroutput"><span class="identifier">xml_node</span></code> is only a handle to the actual node, not the node itself - you can have several <code class="computeroutput"><span class="identifier">xml_node</span></code> handles pointing to the same underlying object. Destroying <code class="computeroutput"><span class="identifier">xml_node</span></code> handle does not destroy the node and does not remove it from the tree. - </p> -<p> + </p><p> There is a special value of <code class="computeroutput"><span class="identifier">xml_node</span></code> type, known as null node or empty node. It does not correspond to any node in any document, and thus resembles null pointer. However, all operations @@ -206,29 +134,21 @@ don't have to check for errors twice. You can test if a handle is null via implicit boolean cast: <code class="computeroutput"><span class="keyword">if</span> <span class="special">(</span><span class="identifier">node</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">node</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span></code>. - </p> -<p> + </p><p> <code class="computeroutput"><span class="identifier">xml_attribute</span></code> is the handle to an XML attribute; it has the same semantics as <code class="computeroutput"><span class="identifier">xml_node</span></code>, i.e. there can be several <code class="computeroutput"><span class="identifier">xml_attribute</span></code> handles pointing to the same underlying object and there is a special null attribute value, which propagates to function results. - </p> -<p> + </p><p> There are two choices of interface and internal representation when configuring pugixml: you can either choose the UTF-8 (also called char) interface or UTF-16/32 (also called wchar_t) one. The choice is controlled via <code class="computeroutput"><span class="identifier">PUGIXML_WCHAR_MODE</span></code> define; you can set it via <code class="filename">pugiconfig.hpp</code> or via preprocessor options. All tree functions that work with strings work with either C-style null terminated strings or STL - strings of the selected character type. <a href="manual/dom.html#manual.dom.unicode" target="_top">Read + strings of the selected character type. <a class="ulink" href="manual/dom.html#manual.dom.unicode" target="_top">Read the manual</a> for additional information on Unicode interface. - </p> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.loading"></a><a class="link" href="quickstart.html#quickstart.main.loading" title="Loading document"> Loading document</a> -</h3></div></div></div> -<p> + </p></div><div class="section" title="Loading document"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.loading"></a><a class="link" href="quickstart.html#quickstart.main.loading" title="Loading document"> Loading document</a></h3></div></div></div><p> pugixml provides several functions for loading XML data from various places - files, C++ iostreams, memory buffers. All functions use an extremely fast non-validating parser. This parser is not fully W3C conformant - it can load @@ -239,36 +159,29 @@ Unicode encodings (UTF-8, UTF-16 (big and little endian), UTF-32 (big and little endian); UCS-2 is naturally supported since it's a strict subset of UTF-16) and handles all encoding conversions automatically. - </p> -<p> + </p><p> The most common source of XML data is files; pugixml provides a separate function for loading XML document from file. This function accepts file path as its first argument, and also two optional arguments, which specify parsing options and input data encoding, which are described in the manual. - </p> -<p> - This is an example of loading XML document from file (<a href="samples/load_file.cpp" target="_top">samples/load_file.cpp</a>): - </p> -<p> + </p><p> + This is an example of loading XML document from file (<a class="ulink" href="samples/load_file.cpp" target="_top">samples/load_file.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_document</span> <span class="identifier">doc</span><span class="special">;</span> +</p><pre class="programlisting"><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">pugi</span><span class="special">::</span><span class="identifier">xml_parse_result</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">load_file</span><span class="special">(</span><span class="string">"tree.xml"</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">"Load result: "</span> <span class="special"><<</span> <span class="identifier">result</span><span class="special">.</span><span class="identifier">description</span><span class="special">()</span> <span class="special"><<</span> <span class="string">", mesh name: "</span> <span class="special"><<</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"mesh"</span><span class="special">).</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"name"</span><span class="special">).</span><span class="identifier">value</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> -<p> +</pre><p> + </p><p> <code class="computeroutput"><span class="identifier">load_file</span></code>, as well as other loading functions, destroys the existing document tree and then tries to load the new tree from the specified file. The result of the operation is returned in an <code class="computeroutput"><span class="identifier">xml_parse_result</span></code> object; this object contains the operation status, and the related information (i.e. last successfully parsed position in the input file, if parsing fails). - </p> -<p> + </p><p> Parsing result object can be implicitly converted to <code class="computeroutput"><span class="keyword">bool</span></code>; if you do not want to handle parsing errors thoroughly, you can just check the return value of load functions as if it was a <code class="computeroutput"><span class="keyword">bool</span></code>: @@ -277,14 +190,11 @@ Otherwise you can use the <code class="computeroutput"><span class="identifier">status</span></code> member to get parsing status, or the <code class="computeroutput"><span class="identifier">description</span><span class="special">()</span></code> member function to get the status in a string form. - </p> -<p> - This is an example of handling loading errors (<a href="samples/load_error_handling.cpp" target="_top">samples/load_error_handling.cpp</a>): - </p> -<p> + </p><p> + This is an example of handling loading errors (<a class="ulink" href="samples/load_error_handling.cpp" target="_top">samples/load_error_handling.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_document</span> <span class="identifier">doc</span><span class="special">;</span> +</p><pre class="programlisting"><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">pugi</span><span class="special">::</span><span class="identifier">xml_parse_result</span> <span class="identifier">result</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="identifier">source</span><span class="special">);</span> <span class="keyword">if</span> <span class="special">(</span><span class="identifier">result</span><span class="special">)</span> @@ -295,10 +205,8 @@ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Error description: "</span> <span class="special"><<</span> <span class="identifier">result</span><span class="special">.</span><span class="identifier">description</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"\n"</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">"Error offset: "</span> <span class="special"><<</span> <span class="identifier">result</span><span class="special">.</span><span class="identifier">offset</span> <span class="special"><<</span> <span class="string">" (error at [..."</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">source</span> <span class="special">+</span> <span class="identifier">result</span><span class="special">.</span><span class="identifier">offset</span><span class="special">)</span> <span class="special"><<</span> <span class="string">"]\n\n"</span><span class="special">;</span> <span class="special">}</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> Sometimes XML data should be loaded from some other source than file, i.e. HTTP URL; also you may want to load XML data from file using non-standard functions, i.e. to use your virtual file system facilities or to load XML @@ -308,8 +216,7 @@ document from C++ IOstream, in which case you should provide an object which implements <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span></code> or <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">wistream</span></code> interface. - </p> -<p> + </p><p> There are different functions for loading document from memory; they treat the passed buffer as either an immutable one (<code class="computeroutput"><span class="identifier">load_buffer</span></code>), a mutable buffer which is owned by the caller (<code class="computeroutput"><span class="identifier">load_buffer_inplace</span></code>), @@ -317,24 +224,18 @@ There is also a simple helper function, <code class="computeroutput"><span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">load</span></code>, for cases when you want to load the XML document from null-terminated character string. - </p> -<p> + </p><p> This is an example of loading XML document from memory using one of these - functions (<a href="samples/load_memory.cpp" target="_top">samples/load_memory.cpp</a>); + functions (<a class="ulink" href="samples/load_memory.cpp" target="_top">samples/load_memory.cpp</a>); read the sample code for more examples: - </p> -<p> + </p><p> -</p> -<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">char</span> <span class="identifier">source</span><span class="special">[]</span> <span class="special">=</span> <span class="string">"<mesh name='sphere'><bounds>0 0 1 1</bounds></mesh>"</span><span class="special">;</span> +</p><pre class="programlisting"><span class="keyword">const</span> <span class="keyword">char</span> <span class="identifier">source</span><span class="special">[]</span> <span class="special">=</span> <span class="string">"<mesh name='sphere'><bounds>0 0 1 1</bounds></mesh>"</span><span class="special">;</span> <span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="keyword">sizeof</span><span class="special">(</span><span class="identifier">source</span><span class="special">);</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> -</p> -<pre class="programlisting"><span class="comment">// You can use load_buffer_inplace to load document from mutable memory block; the block's lifetime must exceed that of document +</p><pre class="programlisting"><span class="comment">// You can use load_buffer_inplace to load document from mutable memory block; the block's lifetime must exceed that of document </span><span class="keyword">char</span><span class="special">*</span> <span class="identifier">buffer</span> <span class="special">=</span> <span class="keyword">new</span> <span class="keyword">char</span><span class="special">[</span><span class="identifier">size</span><span class="special">];</span> <span class="identifier">memcpy</span><span class="special">(</span><span class="identifier">buffer</span><span class="special">,</span> <span class="identifier">source</span><span class="special">,</span> <span class="identifier">size</span><span class="special">);</span> @@ -343,95 +244,70 @@ <span class="comment">// You have to destroy the block yourself after the document is no longer used </span><span class="keyword">delete</span><span class="special">[]</span> <span class="identifier">buffer</span><span class="special">;</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> This is a simple example of loading XML document from file using streams - (<a href="samples/load_stream.cpp" target="_top">samples/load_stream.cpp</a>); read + (<a class="ulink" href="samples/load_stream.cpp" target="_top">samples/load_stream.cpp</a>); read the sample code for more complex examples involving wide streams and locales: - </p> -<p> + </p><p> -</p> -<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">stream</span><span class="special">(</span><span class="string">"weekly-utf-8.xml"</span><span class="special">);</span> +</p><pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ifstream</span> <span class="identifier">stream</span><span class="special">(</span><span class="string">"weekly-utf-8.xml"</span><span class="special">);</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_parse_result</span> <span class="identifier">result</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="identifier">stream</span><span class="special">);</span> -</pre> -<p> - </p> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.access"></a><a class="link" href="quickstart.html#quickstart.main.access" title="Accessing document data"> Accessing document data</a> -</h3></div></div></div> -<p> +</pre><p> + </p></div><div class="section" title="Accessing document data"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.access"></a><a class="link" href="quickstart.html#quickstart.main.access" title="Accessing document data"> Accessing document data</a></h3></div></div></div><p> pugixml features an extensive interface for getting various types of data from the document and for traversing the document. You can use various accessors to get node/attribute data, you can traverse the child node/attribute lists via accessors or iterators, you can do depth-first traversals with <code class="computeroutput"><span class="identifier">xml_tree_walker</span></code> objects, and you can use XPath for complex data-driven queries. - </p> -<p> + </p><p> You can get node or attribute name via <code class="computeroutput"><span class="identifier">name</span><span class="special">()</span></code> accessor, and value via <code class="computeroutput"><span class="identifier">value</span><span class="special">()</span></code> accessor. Note that both functions never return null pointers - they either return a string with the relevant content, or an empty string if name/value is absent or if the handle is null. Also there are two notable things for reading values: - </p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc"> -<li class="listitem"> + </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> 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 <code class="computeroutput"><span class="identifier">node_pcdata</span></code> with value <code class="computeroutput"><span class="string">"This is a node"</span></code>. - pugixml provides <code class="computeroutput"><span class="identifier">child_value</span><span class="special">()</span></code> helper functions to parse such data. - </li> -<li class="listitem"> + pugixml provides <code class="computeroutput"><span class="identifier">child_value</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">text</span><span class="special">()</span></code> helper functions to parse such data. + </li><li class="listitem"> 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. - </li> -</ul></div> -<p> - This is an example of using these functions (<a href="samples/traverse_base.cpp" target="_top">samples/traverse_base.cpp</a>): - </p> -<p> + </li></ul></div><p> + This is an example of using these functions (<a class="ulink" href="samples/traverse_base.cpp" target="_top">samples/traverse_base.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">child</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">);</span> <span class="identifier">tool</span><span class="special">;</span> <span class="identifier">tool</span> <span class="special">=</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">next_sibling</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">))</span> +</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">child</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">);</span> <span class="identifier">tool</span><span class="special">;</span> <span class="identifier">tool</span> <span class="special">=</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">next_sibling</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="identifier">tool</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"Filename"</span><span class="special">).</span><span class="identifier">value</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">": AllowRemote "</span> <span class="special"><<</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"AllowRemote"</span><span class="special">).</span><span class="identifier">as_bool</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">", Timeout "</span> <span class="special"><<</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"Timeout"</span><span class="special">).</span><span class="identifier">as_int</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">", Description '"</span> <span class="special"><<</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">child_value</span><span class="special">(</span><span class="string">"Description"</span><span class="special">)</span> <span class="special"><<</span> <span class="string">"'\n"</span><span class="special">;</span> <span class="special">}</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> Since a lot of document traversal consists of finding the node/attribute with the correct name, there are special functions for that purpose. For example, <code class="computeroutput"><span class="identifier">child</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">)</span></code> returns the first node which has the name <code class="computeroutput"><span class="string">"Tool"</span></code>, or null handle if there is no such node. This is an example of using such - functions (<a href="samples/traverse_base.cpp" target="_top">samples/traverse_base.cpp</a>): - </p> -<p> + functions (<a class="ulink" href="samples/traverse_base.cpp" target="_top">samples/traverse_base.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">"Tool for *.dae generation: "</span> <span class="special"><<</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">find_child_by_attribute</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">,</span> <span class="string">"OutputFileMasks"</span><span class="special">,</span> <span class="string">"*.dae"</span><span class="special">).</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"Filename"</span><span class="special">).</span><span class="identifier">value</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span> +</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">"Tool for *.dae generation: "</span> <span class="special"><<</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">find_child_by_attribute</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">,</span> <span class="string">"OutputFileMasks"</span><span class="special">,</span> <span class="string">"*.dae"</span><span class="special">).</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"Filename"</span><span class="special">).</span><span class="identifier">value</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"\n"</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">tool</span> <span class="special">=</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"Tool"</span><span class="special">);</span> <span class="identifier">tool</span><span class="special">;</span> <span class="identifier">tool</span> <span class="special">=</span> <span class="identifier">tool</span><span class="special">.</span><span class="identifier">next_sibling</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="identifier">tool</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"Filename"</span><span class="special">).</span><span class="identifier">value</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span> <span class="special">}</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> Child node lists and attribute lists are simply double-linked lists; while you can use <code class="computeroutput"><span class="identifier">previous_sibling</span></code>/<code class="computeroutput"><span class="identifier">next_sibling</span></code> and other such functions for iteration, pugixml additionally provides node and attribute iterators, so @@ -440,14 +316,11 @@ iterators are invalidated if the node/attribute objects they're pointing to are removed from the tree; adding nodes/attributes does not invalidate any iterators. - </p> -<p> - Here is an example of using iterators for document traversal (<a href="samples/traverse_iter.cpp" target="_top">samples/traverse_iter.cpp</a>): - </p> -<p> + </p><p> + Here is an example of using iterators for document traversal (<a class="ulink" href="samples/traverse_iter.cpp" target="_top">samples/traverse_iter.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_iterator</span> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">it</span> <span class="special">!=</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">it</span><span class="special">)</span> +</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_iterator</span> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">it</span> <span class="special">!=</span> <span class="identifier">tools</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">it</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> @@ -458,10 +331,37 @@ <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> -<p> +</pre><p> + </p><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 class="ulink" href="http://www.boost.org/libs/foreach/" target="_top">Boost Foreach</a>, + and possibly other pre-C++11 foreach facilities. + </p><p> + Here is an example of using C++11 range-based for loop for document traversal + (<a class="ulink" 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><p> The methods described above allow traversal of immediate children of some node; if you want to do a deep tree traversal, you'll have to do it via a recursive function or some equivalent method. However, pugixml provides a @@ -469,14 +369,11 @@ to implement <code class="computeroutput"><span class="identifier">xml_tree_walker</span></code> interface and to call <code class="computeroutput"><span class="identifier">traverse</span></code> function. - </p> -<p> - This is an example of traversing tree hierarchy with xml_tree_walker (<a href="samples/traverse_walker.cpp" target="_top">samples/traverse_walker.cpp</a>): - </p> -<p> + </p><p> + This is an example of traversing tree hierarchy with xml_tree_walker (<a class="ulink" href="samples/traverse_walker.cpp" target="_top">samples/traverse_walker.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">simple_walker</span><span class="special">:</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_tree_walker</span> +</p><pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">simple_walker</span><span class="special">:</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_tree_walker</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="keyword">bool</span> <span class="identifier">for_each</span><span class="special">(</span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span><span class="special">&</span> <span class="identifier">node</span><span class="special">)</span> <span class="special">{</span> @@ -487,27 +384,20 @@ <span class="keyword">return</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// continue traversal </span> <span class="special">}</span> <span class="special">};</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> -</p> -<pre class="programlisting"><span class="identifier">simple_walker</span> <span class="identifier">walker</span><span class="special">;</span> +</p><pre class="programlisting"><span class="identifier">simple_walker</span> <span class="identifier">walker</span><span class="special">;</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">traverse</span><span class="special">(</span><span class="identifier">walker</span><span class="special">);</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> Finally, for complex queries often a higher-level DSL is needed. pugixml provides an implementation of XPath 1.0 language for such queries. The complete description of XPath usage can be found in the manual, but here are some examples: - </p> -<p> + </p><p> -</p> -<pre class="programlisting"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xpath_node_set</span> <span class="identifier">tools</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">select_nodes</span><span class="special">(</span><span class="string">"/Profile/Tools/Tool[@AllowRemote='true' and @DeriveCaptionFrom='lastparam']"</span><span class="special">);</span> +</p><pre class="programlisting"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xpath_node_set</span> <span class="identifier">tools</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">select_nodes</span><span class="special">(</span><span class="string">"/Profile/Tools/Tool[@AllowRemote='true' and @DeriveCaptionFrom='lastparam']"</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">"Tools:"</span><span class="special">;</span> @@ -520,25 +410,11 @@ <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xpath_node</span> <span class="identifier">build_tool</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">select_single_node</span><span class="special">(</span><span class="string">"//Tool[contains(Description, 'build system')]"</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">"\nBuild tool: "</span> <span class="special"><<</span> <span class="identifier">build_tool</span><span class="special">.</span><span class="identifier">node</span><span class="special">().</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"Filename"</span><span class="special">).</span><span class="identifier">value</span><span class="special">()</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span> -</pre> -<p> - </p> -<div class="caution"><table border="0" summary="Caution"> -<tr> -<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td> -<th align="left">Caution</th> -</tr> -<tr><td align="left" valign="top"><p> +</pre><p> + </p><div class="caution" title="Caution"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p> XPath functions throw <code class="computeroutput"><span class="identifier">xpath_exception</span></code> objects on error; the sample above does not catch these exceptions. - </p></td></tr> -</table></div> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.modify"></a><a class="link" href="quickstart.html#quickstart.main.modify" title="Modifying document data"> Modifying document data</a> -</h3></div></div></div> -<p> + </p></td></tr></table></div></div><div class="section" title="Modifying document data"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.modify"></a><a class="link" href="quickstart.html#quickstart.main.modify" title="Modifying document data"> Modifying document data</a></h3></div></div></div><p> The document in pugixml is fully mutable: you can completely change the document structure and modify the data of nodes/attributes. All functions take care of memory management and structural integrity themselves, so they always @@ -549,27 +425,23 @@ memory you can create documents from scratch with pugixml and later save them to file/stream instead of relying on error-prone manual text writing and without too much overhead. - </p> -<p> + </p><p> All member functions that change node/attribute data or structure are non-constant and thus can not be called on constant handles. However, you can easily convert constant handle to non-constant one by simple assignment: <code class="computeroutput"><span class="keyword">void</span> <span class="identifier">foo</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span><span class="special">&</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">nc</span> <span class="special">=</span> <span class="identifier">n</span><span class="special">;</span> <span class="special">}</span></code>, so const-correctness here mainly provides additional documentation. - </p> -<p> + </p><p> As discussed before, nodes can have name and value, both of which are strings. Depending on node type, name or value may be absent. You can use <code class="computeroutput"><span class="identifier">set_name</span></code> and <code class="computeroutput"><span class="identifier">set_value</span></code> member functions to set them. Similar functions are available for attributes; however, the <code class="computeroutput"><span class="identifier">set_value</span></code> function is overloaded for some other types except strings, like floating-point numbers. Also, attribute value can be set using an assignment operator. This is an - example of setting node/attribute name and value (<a href="samples/modify_base.cpp" target="_top">samples/modify_base.cpp</a>): - </p> -<p> + example of setting node/attribute name and value (<a class="ulink" href="samples/modify_base.cpp" target="_top">samples/modify_base.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">node</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"node"</span><span class="special">);</span> +</p><pre class="programlisting"><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">node</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"node"</span><span class="special">);</span> <span class="comment">// change node name </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">node</span><span class="special">.</span><span class="identifier">set_name</span><span class="special">(</span><span class="string">"notnode"</span><span class="special">);</span> @@ -581,13 +453,10 @@ <span class="comment">// we can't change value of the element or name of the comment </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">node</span><span class="special">.</span><span class="identifier">set_value</span><span class="special">(</span><span class="string">"1"</span><span class="special">)</span> <span class="special"><<</span> <span class="string">", "</span> <span class="special"><<</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">last_child</span><span class="special">().</span><span class="identifier">set_name</span><span class="special">(</span><span class="string">"2"</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> -<p> +</pre><p> + </p><p> -</p> -<pre class="programlisting"><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">node</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"id"</span><span class="special">);</span> +</p><pre class="programlisting"><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">node</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"id"</span><span class="special">);</span> <span class="comment">// change attribute name/value </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">attr</span><span class="special">.</span><span class="identifier">set_name</span><span class="special">(</span><span class="string">"key"</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">set_value</span><span class="special">(</span><span class="string">"345"</span><span class="special">);</span> @@ -600,10 +469,8 @@ <span class="comment">// we can also use assignment operators for more concise code </span><span class="identifier">attr</span> <span class="special">=</span> <span class="keyword">true</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">"final attribute value: "</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="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> Nodes and attributes do not exist without a document tree, so you can't create them without adding them to some document. A node or attribute can be created at the end of node/attribute list or before/after some other node. All insertion @@ -611,26 +478,16 @@ handle on failure. Even if the operation fails (for example, if you're trying to add a child node to PCDATA node), the document remains in consistent state, but the requested node/attribute is not added. - </p> -<div class="caution"><table border="0" summary="Caution"> -<tr> -<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td> -<th align="left">Caution</th> -</tr> -<tr><td align="left" valign="top"><p> + </p><div class="caution" title="Caution"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p> attribute() and child() functions do not add attributes or nodes to the tree, so code like <code class="computeroutput"><span class="identifier">node</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"id"</span><span class="special">)</span> <span class="special">=</span> <span class="number">123</span><span class="special">;</span></code> will not do anything if <code class="computeroutput"><span class="identifier">node</span></code> does not have an attribute with name <code class="computeroutput"><span class="string">"id"</span></code>. Make sure you're operating with existing attributes/nodes by adding them if necessary. - </p></td></tr> -</table></div> -<p> - This is an example of adding new attributes/nodes to the document (<a href="samples/modify_add.cpp" target="_top">samples/modify_add.cpp</a>): - </p> -<p> + </p></td></tr></table></div><p> + This is an example of adding new attributes/nodes to the document (<a class="ulink" href="samples/modify_add.cpp" target="_top">samples/modify_add.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="comment">// add node with some name +</p><pre class="programlisting"><span class="comment">// add node with some name </span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">node</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">append_child</span><span class="special">(</span><span class="string">"node"</span><span class="special">);</span> <span class="comment">// add description node with text child @@ -644,10 +501,8 @@ </span><span class="identifier">param</span><span class="special">.</span><span class="identifier">append_attribute</span><span class="special">(</span><span class="string">"name"</span><span class="special">)</span> <span class="special">=</span> <span class="string">"version"</span><span class="special">;</span> <span class="identifier">param</span><span class="special">.</span><span class="identifier">append_attribute</span><span class="special">(</span><span class="string">"value"</span><span class="special">)</span> <span class="special">=</span> <span class="number">1.1</span><span class="special">;</span> <span class="identifier">param</span><span class="special">.</span><span class="identifier">insert_attribute_after</span><span class="special">(</span><span class="string">"type"</span><span class="special">,</span> <span class="identifier">param</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"name"</span><span class="special">))</span> <span class="special">=</span> <span class="string">"float"</span><span class="special">;</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> If you do not want your document to contain some node or attribute, you can remove it with <code class="computeroutput"><span class="identifier">remove_attribute</span></code> and <code class="computeroutput"><span class="identifier">remove_child</span></code> functions. @@ -656,14 +511,11 @@ node also invalidates all past-the-end iterators to its attribute or child node list. Be careful to ensure that all such handles and iterators either do not exist or are not used after the attribute/node is removed. - </p> -<p> - This is an example of removing attributes/nodes from the document (<a href="samples/modify_remove.cpp" target="_top">samples/modify_remove.cpp</a>): - </p> -<p> + </p><p> + This is an example of removing attributes/nodes from the document (<a class="ulink" href="samples/modify_remove.cpp" target="_top">samples/modify_remove.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="comment">// remove description node with the whole subtree +</p><pre class="programlisting"><span class="comment">// remove description node with the whole subtree </span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_node</span> <span class="identifier">node</span> <span class="special">=</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">child</span><span class="special">(</span><span class="string">"node"</span><span class="special">);</span> <span class="identifier">node</span><span class="special">.</span><span class="identifier">remove_child</span><span class="special">(</span><span class="string">"description"</span><span class="special">);</span> @@ -674,15 +526,8 @@ <span class="comment">// we can also remove nodes/attributes by handles </span><span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_attribute</span> <span class="identifier">id</span> <span class="special">=</span> <span class="identifier">param</span><span class="special">.</span><span class="identifier">attribute</span><span class="special">(</span><span class="string">"name"</span><span class="special">);</span> <span class="identifier">param</span><span class="special">.</span><span class="identifier">remove_attribute</span><span class="special">(</span><span class="identifier">id</span><span class="special">);</span> -</pre> -<p> - </p> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.saving"></a><a class="link" href="quickstart.html#quickstart.main.saving" title="Saving document"> Saving document</a> -</h3></div></div></div> -<p> +</pre><p> + </p></div><div class="section" title="Saving document"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.saving"></a><a class="link" href="quickstart.html#quickstart.main.saving" title="Saving document"> Saving document</a></h3></div></div></div><p> Often after creating a new document or loading the existing one and processing it, it is necessary to save the result back to file. Also it is occasionally useful to output the whole document or a subtree to some stream; use cases @@ -691,28 +536,22 @@ the document to a file, stream or another generic transport interface; these functions allow to customize the output format, and also perform necessary encoding conversions. - </p> -<p> + </p><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>. For well-formed output, make sure all node and attribute names are set to meaningful values. - </p> -<p> + </p><p> If you want to save the whole document to a file, you can use the <code class="computeroutput"><span class="identifier">save_file</span></code> function, which returns <code class="computeroutput"><span class="keyword">true</span></code> on success. This is a simple example - of saving XML document to file (<a href="samples/save_file.cpp" target="_top">samples/save_file.cpp</a>): - </p> -<p> + of saving XML document to file (<a class="ulink" href="samples/save_file.cpp" target="_top">samples/save_file.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="comment">// save document to file +</p><pre class="programlisting"><span class="comment">// save document to file </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Saving result: "</span> <span class="special"><<</span> <span class="identifier">doc</span><span class="special">.</span><span class="identifier">save_file</span><span class="special">(</span><span class="string">"save_file_output.xml"</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> -<p> +</pre><p> + </p><p> To enhance interoperability pugixml provides functions for saving document to any object which implements C++ <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span></code> interface. This allows you to save documents to any standard C++ stream (i.e. @@ -720,20 +559,15 @@ Most notably, this allows for easy debug output, since you can use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span></code> stream as saving target. There are two functions, one works with narrow character streams, another handles wide character ones. - </p> -<p> - This is a simple example of saving XML document to standard output (<a href="samples/save_stream.cpp" target="_top">samples/save_stream.cpp</a>): - </p> -<p> + </p><p> + This is a simple example of saving XML document to standard output (<a class="ulink" href="samples/save_stream.cpp" target="_top">samples/save_stream.cpp</a>): + </p><p> -</p> -<pre class="programlisting"><span class="comment">// save document to standard output +</p><pre class="programlisting"><span class="comment">// save document to standard output </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Document:\n"</span><span class="special">;</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> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> All of the above saving functions are implemented in terms of writer interface. This is a simple interface with a single function, which is called several times during output process with chunks of document data as input. In order @@ -741,16 +575,13 @@ should create an object which implements <code class="computeroutput"><span class="identifier">xml_writer_file</span></code> interface and pass it to <code class="computeroutput"><span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">save</span></code> function. - </p> -<p> + </p><p> This is a simple example of custom writer for saving document data to STL - string (<a href="samples/save_custom_writer.cpp" target="_top">samples/save_custom_writer.cpp</a>); + string (<a class="ulink" href="samples/save_custom_writer.cpp" target="_top">samples/save_custom_writer.cpp</a>); read the sample code for more complex examples: - </p> -<p> + </p><p> -</p> -<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">xml_string_writer</span><span class="special">:</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_writer</span> +</p><pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">xml_string_writer</span><span class="special">:</span> <span class="identifier">pugi</span><span class="special">::</span><span class="identifier">xml_writer</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">result</span><span class="special">;</span> @@ -759,58 +590,38 @@ <span class="identifier">result</span> <span class="special">+=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*>(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">size</span><span class="special">);</span> <span class="special">}</span> <span class="special">};</span> -</pre> -<p> - </p> -<p> +</pre><p> + </p><p> While the previously described functions save the whole document to the destination, it is easy to save a single subtree. Instead of calling <code class="computeroutput"><span class="identifier">xml_document</span><span class="special">::</span><span class="identifier">save</span></code>, just call <code class="computeroutput"><span class="identifier">xml_node</span><span class="special">::</span><span class="identifier">print</span></code> function on the target node. You can save node contents to C++ IOstream object or custom writer in this way. - Saving a subtree slightly differs from saving the whole document; <a href="manual/saving.html#manual.saving.subtree" target="_top">read the manual</a> for + Saving a subtree slightly differs from saving the whole document; <a class="ulink" href="manual/saving.html#manual.saving.subtree" target="_top">read the manual</a> for more information. - </p> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.feedback"></a><a class="link" href="quickstart.html#quickstart.main.feedback" title="Feedback"> Feedback</a> -</h3></div></div></div> -<p> - If you believe you've found a bug in pugixml, please file an issue via <a href="http://code.google.com/p/pugixml/issues/entry" target="_top">issue submission form</a>. + </p></div><div class="section" title="Feedback"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.feedback"></a><a class="link" href="quickstart.html#quickstart.main.feedback" title="Feedback"> Feedback</a></h3></div></div></div><p> + If you believe you've found a bug in pugixml, please file an issue via <a class="ulink" href="http://code.google.com/p/pugixml/issues/entry" target="_top">issue submission form</a>. Be sure to include the relevant information so that the bug can be reproduced: the version of pugixml, compiler version and target architecture, the code that uses pugixml and exhibits the bug, etc. Feature requests and contributions can be filed as issues, too. - </p> -<a name="email"></a><p> + </p><a name="email"></a><p> If filing an issue is not possible due to privacy or other concerns, you - can contact pugixml author by e-mail directly: <a href="mailto:arseny.kapoulkine@gmail.com" target="_top">arseny.kapoulkine@gmail.com</a>. - </p> -</div> -<div class="section"> -<div class="titlepage"><div><div><h3 class="title"> -<a name="quickstart.main.license"></a><a class="link" href="quickstart.html#quickstart.main.license" title="License"> License</a> -</h3></div></div></div> -<p> + can contact pugixml author by e-mail directly: <a class="ulink" href="mailto:arseny.kapoulkine@gmail.com" target="_top">arseny.kapoulkine@gmail.com</a>. + </p></div><div class="section" title="License"><div class="titlepage"><div><div><h3 class="title"><a name="quickstart.main.license"></a><a class="link" href="quickstart.html#quickstart.main.license" title="License"> License</a></h3></div></div></div><p> The pugixml library is distributed under the MIT license: - </p> -<div class="blockquote"><blockquote class="blockquote"> -<p> - Copyright (c) 2006-2010 Arseny Kapoulkine - </p> -<p> + </p><div class="blockquote"><blockquote class="blockquote"><p> + Copyright (c) 2006-2012 Arseny Kapoulkine + </p><p> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - </p> -<p> + </p><p> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - </p> -<p> + </p><p> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -818,28 +629,12 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - </p> -</blockquote></div> -<p> + </p></blockquote></div><p> This means that you can freely use pugixml in your applications, both open-source and proprietary. If you use pugixml in a product, it is sufficient to add an acknowledgment like this to the product distribution: - </p> -<div class="blockquote"><blockquote class="blockquote"><p> + </p><div class="blockquote"><blockquote class="blockquote"><p> This software is based on pugixml library (http://pugixml.org).<br> pugixml - is Copyright (C) 2006-2010 Arseny Kapoulkine. - </p></blockquote></div> -</div> -</div> -<div class="footnotes"> -<br><hr width="100" align="left"> -<div class="footnote"><p><sup>[<a name="ftn.trademarks" href="#trademarks" class="para">1</a>] </sup>All trademarks used are properties of their respective owners.</p></div> -</div> -</div> -<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> -<td align="left"><p><small>Last revised: October 31, 2010 at 07:44:52 GMT</small></p></td> -<td align="right"><div class="copyright-footer"></div></td> -</tr></table> -</body> -</html> + is Copyright (C) 2006-2012 Arseny Kapoulkine. + </p></blockquote></div></div></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.trademarks" href="#trademarks" class="para">1</a>] </sup>All trademarks used are properties of their respective owners.</p></div></div></div></body></html> |