Skip to content
Snippets Groups Projects
manual.html 668 KiB
Newer Older
<span class="tok-w">    </span><span class="tok-n">doc</span><span class="tok-p">.</span><span class="tok-n">select_nodes</span><span class="tok-p">(</span><span class="tok-s">&quot;//nodes[#true()]&quot;</span><span class="tok-p">);</span><span class="tok-w"></span>
<span class="tok-p">}</span><span class="tok-w"></span>
<span class="tok-k">catch</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">pugi</span><span class="tok-o">::</span><span class="tok-n">xpath_exception</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">)</span><span class="tok-w"></span>
<span class="tok-p">{</span><span class="tok-w"></span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">cout</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-s">&quot;Select failed: &quot;</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">.</span><span class="tok-n">what</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">endl</span><span class="tok-p">;</span><span class="tok-w"></span>
<span class="tok-p">}</span><span class="tok-w"></span>

<span class="tok-c1">// Exception is thrown for incorrect query semantics</span>
<span class="tok-k">try</span><span class="tok-w"></span>
<span class="tok-p">{</span><span class="tok-w"></span>
<span class="tok-w">    </span><span class="tok-n">doc</span><span class="tok-p">.</span><span class="tok-n">select_nodes</span><span class="tok-p">(</span><span class="tok-s">&quot;(123)/next&quot;</span><span class="tok-p">);</span><span class="tok-w"></span>
<span class="tok-p">}</span><span class="tok-w"></span>
<span class="tok-k">catch</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">pugi</span><span class="tok-o">::</span><span class="tok-n">xpath_exception</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">)</span><span class="tok-w"></span>
<span class="tok-p">{</span><span class="tok-w"></span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">cout</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-s">&quot;Select failed: &quot;</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">.</span><span class="tok-n">what</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">endl</span><span class="tok-p">;</span><span class="tok-w"></span>
<span class="tok-p">}</span><span class="tok-w"></span>

<span class="tok-c1">// Exception is thrown for query with incorrect return type</span>
<span class="tok-k">try</span><span class="tok-w"></span>
<span class="tok-p">{</span><span class="tok-w"></span>
<span class="tok-w">    </span><span class="tok-n">doc</span><span class="tok-p">.</span><span class="tok-n">select_nodes</span><span class="tok-p">(</span><span class="tok-s">&quot;123&quot;</span><span class="tok-p">);</span><span class="tok-w"></span>
<span class="tok-p">}</span><span class="tok-w"></span>
<span class="tok-k">catch</span><span class="tok-w"> </span><span class="tok-p">(</span><span class="tok-k">const</span><span class="tok-w"> </span><span class="tok-n">pugi</span><span class="tok-o">::</span><span class="tok-n">xpath_exception</span><span class="tok-o">&amp;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">)</span><span class="tok-w"></span>
<span class="tok-p">{</span><span class="tok-w"></span>
<span class="tok-w">    </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">cout</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-s">&quot;Select failed: &quot;</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-n">e</span><span class="tok-p">.</span><span class="tok-n">what</span><span class="tok-p">()</span><span class="tok-w"> </span><span class="tok-o">&lt;&lt;</span><span class="tok-w"> </span><span class="tok-n">std</span><span class="tok-o">::</span><span class="tok-n">endl</span><span class="tok-p">;</span><span class="tok-w"></span>
<span class="tok-p">}</span><span class="tok-w"></span></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="xpath.w3c"><a class="anchor" href="#xpath.w3c"></a><a class="link" href="#xpath.w3c">8.6. Conformance to W3C specification</a></h3>
<div class="paragraph">
<p>Because of the differences in document object models, performance considerations and implementation complexity, pugixml does not provide a fully conformant XPath 1.0 implementation. This is the current list of incompatibilities:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Consecutive text nodes sharing the same parent are not merged, i.e. in <code>&lt;node&gt;text1 &lt;![CDATA[data]]&gt; text2&lt;/node&gt;</code> node should have one text node child, but instead has three.</p>
</li>
<li>
<p>Since the document type declaration is not used for parsing, <code>id()</code> function always returns an empty node set.</p>
</li>
<li>
<p>Namespace nodes are not supported (affects <code>namespace::</code> axis).</p>
</li>
<li>
<p>Name tests are performed on QNames in XML document instead of expanded names; for <code>&lt;foo xmlns:ns1='uri' xmlns:ns2='uri'&gt;&lt;ns1:child/&gt;&lt;ns2:child/&gt;&lt;/foo&gt;</code>, query <code>foo/ns1:*</code> will return only the first child, not both of them. Compliant XPath implementations can return both nodes if the user provides appropriate namespace declarations.</p>
</li>
<li>
<p>String functions consider a character to be either a single <code>char</code> value or a single <code>wchar_t</code> value, depending on the library configuration; this means that some string functions are not fully Unicode-aware. This affects <code>substring()</code>, <code>string-length()</code> and <code>translate()</code> functions.</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="changes"><a class="anchor" href="#changes"></a><a class="link" href="#changes">9. Changelog</a></h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="v1.12"><a class="anchor" href="#v1.12"></a><a class="link" href="#v1.12">v1.12 <sup>2022-02-09</sup></a></h3>
<div class="paragraph">
<p>Maintenance release. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Bug fixes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fix a bug in xml_document move construction when the source of the move is empty</p>
</li>
<li>
<p>Fix const-correctness issues with iterator objects to support C++20 ranges</p>
</li>
</ol>
</div>
</li>
<li>
<p>XPath improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Improved detection of overly complex queries that may result in stack overflow during parsing</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fix Cygwin support for DLL builds</p>
</li>
<li>
<p>Fix Windows CE support</p>
</li>
<li>
<p>Add NuGet builds and project files for VS2022</p>
</li>
</ol>
</div>
</li>
<li>
<p>Build system changes</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>All CMake options now have the prefix <code>PUGIXML_</code>. This may require changing dependent build configurations.</p>
</li>
<li>
<p>Many build settings are now exposed via CMake settings, most notably <code>PUGIXML_COMPACT</code> and <code>PUGIXML_WCHAR_MODE</code> can be set without changing <code>pugiconfig.hpp</code></p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.11"><a class="anchor" href="#v1.11"></a><a class="link" href="#v1.11">v1.11 <sup>2020-11-26</sup></a></h3>
<div class="paragraph">
<p>Maintenance release. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Add xml_node::remove_attributes and xml_node::remove_children</p>
</li>
<li>
<p>Add a way to customize floating point precision via xml_attribute::set and xml_text::set overloads</p>
</li>
</ol>
</div>
</li>
<li>
<p>XPath improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>XPath parser now limits recursion depth which prevents stack overflow on malicious queries</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fix Visual Studio warnings when built using clang-cl compiler</p>
</li>
<li>
<p>Fix Wconversion warnings in gcc</p>
</li>
<li>
<p>Fix Wzero-as-null-pointer-constant warnings in pugixml.hpp</p>
</li>
<li>
<p>Work around several static analysis false positives</p>
</li>
</ol>
</div>
</li>
<li>
<p>Build system changes</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>The CMake package for pugixml now provides a <code>pugixml::pugixml</code> target rather than a <code>pugixml</code> target. A compatibility <code>pugixml</code> target is provided if at least version 1.11 is not requested.</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.10"><a class="anchor" href="#v1.10"></a><a class="link" href="#v1.10">v1.10 <sup>2019-09-15</sup></a></h3>
<div class="paragraph">
<p>Maintenance release. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Behavior changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Tab characters (ASCII 9) in attribute values are now encoded as '&amp;#9;' to survive roundtripping</p>
</li>
<li>
<p><code>&gt;</code> characters are no longer escaped in attribute values</p>
</li>
</ol>
</div>
</li>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Add Visual Studio .natvis files to improve debugging experience</p>
</li>
<li>
<p>CMake improvements (USE_POSTFIX and BUILD_SHARED_AND_STATIC_LIBS options for building multiple versions and pkg-config tweaks)</p>
</li>
<li>
<p>Add format_skip_control_chars formatting flag to skip non-printable ASCII characters that are invalid to use in well-formed XML files</p>
</li>
<li>
<p>Add format_attribute_single_quote formatting flag to use single quotes for attribute values instead of default double quotes.</p>
</li>
</ol>
</div>
</li>
<li>
<p>XPath improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>XPath union now results in a stable order that doesn&#8217;t depend on memory allocations; crucially, this may require sorting the output of XPath query operation if you rely on the document-ordered traversal</p>
</li>
<li>
<p>Improve performance of XPath union operation, making it ~2x faster</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fix Visual Studio warnings when built in a DLL configuration</p>
</li>
<li>
<p>Fix static analysis false positives in Coverity and clang</p>
</li>
<li>
<p>Fix Wdouble-promotion warnings in gcc</p>
</li>
<li>
<p>Add Visual Studio 2019 support for NuGet packages</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.9"><a class="anchor" href="#v1.9"></a><a class="link" href="#v1.9">v1.9 <sup>2018-04-04</sup></a></h3>
<div class="paragraph">
<p>Maintenance release. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Specification changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><code>xml_document::load(const char*)</code> (deprecated in 1.5) now has <code>deprecated</code> attribute; use <code>xml_document::load_string</code> instead</p>
</li>
<li>
<p><code>xml_node::select_single_node</code> (deprecated in 1.5) now has <code>deprecated</code> attribute; use <code>xml_node::select_node</code> instead</p>
</li>
</ol>
</div>
</li>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Add move semantics support for xml_document and improve move semantics support for other objects</p>
</li>
<li>
<p>CMake build now exports include directories</p>
</li>
<li>
<p>CMake build with BUILD_SHARED_LIBS=ON now uses dllexport attribute for MSVC</p>
</li>
</ol>
</div>
</li>
<li>
<p>XPath improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Rework parser/evaluator to not rely on exceptional control flow; longjmp is no longer used when exceptions are disabled</p>
</li>
<li>
<p>Improve error messages for certain invalid expressions such as <code>.[1]</code> or <code>(1</code></p>
</li>
<li>
<p>Minor performance improvements</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fix Texas Instruments compiler warnings</p>
</li>
<li>
<p>Fix compilation issues with limits.h for some versions of gcc</p>
</li>
<li>
<p>Fix compilation issues with Clang/C2</p>
</li>
<li>
<p>Fix implicit fallthrough warnings in gcc 7</p>
</li>
<li>
<p>Fix unknown attribute directive warnings in gcc 8</p>
</li>
<li>
<p>Fix cray++ compiler errors</p>
</li>
<li>
<p>Fix unsigned integer overflow errors with -fsanitize=integer</p>
</li>
<li>
<p>Fix undefined behavior sanitizer issues in compact mode</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.8"><a class="anchor" href="#v1.8"></a><a class="link" href="#v1.8">v1.8 <sup>2016-11-24</sup></a></h3>
<div class="paragraph">
<p>Maintenance release. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Specification changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>When printing empty elements, a space is no longer added before / in format_raw mode</p>
</li>
</ol>
</div>
</li>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Added parse_embed_pcdata parsing mode in which PCDATA value is stored in the element node if possible (significantly reducing memory consumption for some documents)</p>
</li>
<li>
<p>Added auto-detection support for Latin-1 (ISO-8859-1) encoding during parsing</p>
</li>
<li>
<p>Added format_no_empty_element_tags formatting flag that outputs start/end tags instead of empty element tags for empty elements</p>
</li>
</ol>
</div>
</li>
<li>
<p>Performance improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Minor memory allocation improvements (yielding up to 1% memory savings in some cases)</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fixed compilation issues for Borland C++ 5.4</p>
</li>
<li>
<p>Fixed compilation issues for some distributions of MinGW 3.8</p>
</li>
<li>
<p>Fixed various Clang/GCC warnings</p>
</li>
<li>
<p>Enabled move semantics support for XPath objects for MSVC 2010 and above</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.7"><a class="anchor" href="#v1.7"></a><a class="link" href="#v1.7">v1.7 <sup>2015-10-19</sup></a></h3>
<div class="paragraph">
<p>Major release, featuring performance and memory improvements along with some new features. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Compact mode:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Introduced a new tree storage mode that takes significantly less memory (2-5x smaller DOM) at some performance cost.</p>
</li>
<li>
<p>The mode can be enabled using <code>PUGIXML_COMPACT</code> define.</p>
</li>
</ol>
</div>
</li>
<li>
<p>New integer parsing/formatting implementation:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Functions that convert from and to integers (e.g. <code>as_int</code>/<code>set_value</code>) do not rely on CRT any more.</p>
</li>
<li>
<p>New implementation is 3-5x faster and is always correct wrt overflow or underflow. This is a behavior change - where previously <code>as_uint()</code> would return UINT_MAX on a value "-1", it now returns 0.</p>
</li>
</ol>
</div>
</li>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>XPath objects (<code>xpath_query</code>, <code>xpath_node_set</code>, <code>xpath_variable_set</code>) are now movable if your compiler supports C++11. Additionally, <code>xpath_variable_set</code> is copyable.</p>
</li>
<li>
<p>Added <code>format_indent_attributes</code> that makes the resulting XML friendlier to line diff/merge tools.</p>
</li>
<li>
<p>Added a variant of <code>xml_node::attribute</code> function with a hint that can improve lookup performance.</p>
</li>
<li>
<p>Custom allocation functions are now allowed (but not required) to throw instead of returning a null pointer.</p>
</li>
</ol>
</div>
</li>
<li>
<p>Bug fixes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fix Clang 3.7 crashes in out-of-memory cases (C++ DR 1748)</p>
</li>
<li>
<p>Fix XPath crashes on SPARC64 (and other 32-bit architectures where doubles have to be aligned to 8 bytes)</p>
</li>
<li>
<p>Fix xpath_node_set assignment to provide strong exception guarantee</p>
</li>
<li>
<p>Fix saving for custom xml_writer implementations that can throw from write()</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.6"><a class="anchor" href="#v1.6"></a><a class="link" href="#v1.6">v1.6 <sup>2015-04-10</sup></a></h3>
<div class="paragraph">
<p>Maintenance release. Changes:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Specification changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Attribute/text values now use more digits when printing floating point numbers to guarantee round-tripping.</p>
</li>
<li>
<p>Text nodes no longer get extra surrounding whitespace when pretty-printing nodes with mixed contents</p>
</li>
</ol>
</div>
</li>
<li>
<p>Bug fixes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fixed translate and normalize-space XPath functions to no longer return internal NUL characters</p>
</li>
<li>
<p>Fixed buffer overrun on malformed comments inside DOCTYPE sections</p>
</li>
<li>
<p>DOCTYPE parsing can no longer run out of stack space on malformed inputs (XML parsing is now using bounded stack space)</p>
</li>
<li>
<p>Adjusted processing instruction output to avoid malformed documents if the PI value contains <code>?&gt;</code></p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.5"><a class="anchor" href="#v1.5"></a><a class="link" href="#v1.5">v1.5 <sup>2014-11-27</sup></a></h3>
<div class="paragraph">
<p>Major release, featuring a lot of performance improvements and some new features.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Specification changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><code>xml_document::load(const char_t*)</code> was renamed to <code>load_string</code>; the old method is still available and will be deprecated in a future release</p>
</li>
<li>
<p><code>xml_node::select_single_node</code> was renamed to <code>select_node</code>; the old method is still available and will be deprecated in a future release.</p>
</li>
</ol>
</div>
</li>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Added <code>xml_node::append_move</code> and other functions for moving nodes within a document</p>
</li>
<li>
<p>Added <code>xpath_query::evaluate_node</code> for evaluating queries with a single node as a result</p>
</li>
</ol>
</div>
</li>
<li>
<p>Performance improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Optimized XML parsing (10-40% faster with clang/gcc, up to 10% faster with MSVC)</p>
</li>
<li>
<p>Optimized memory consumption when copying nodes in the same document (string contents is now shared)</p>
</li>
<li>
<p>Optimized node copying (10% faster for cross-document copies, 3x faster for inter-document copies; also it now consumes a constant amount of stack space)</p>
</li>
<li>
<p>Optimized node output (60% faster; also it now consumes a constant amount of stack space)</p>
</li>
<li>
<p>Optimized XPath allocation (query evaluation now results in fewer temporary allocations)</p>
</li>
<li>
<p>Optimized XPath sorting (node set sorting is 2-3x faster in some cases)</p>
</li>
<li>
<p>Optimized XPath evaluation (XPathMark suite is 100x faster; some commonly used queries are 3-4x faster)</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fixed <code>xml_node::offset_debug</code> for corner cases</p>
</li>
<li>
<p>Fixed undefined behavior while calling memcpy in some cases</p>
</li>
<li>
<p>Fixed MSVC 2015 compilation warnings</p>
</li>
<li>
<p>Fixed <code>contrib/foreach.hpp</code> for Boost 1.56.0</p>
</li>
</ol>
</div>
</li>
<li>
<p>Bug fixes</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Adjusted comment output to avoid malformed documents if the comment value contains <code>--</code></p>
</li>
<li>
<p>Fix XPath sorting for documents that were constructed using append_buffer</p>
</li>
<li>
<p>Fix <code>load_file</code> for wide-character paths with non-ASCII characters in MinGW with C&#43;&#43;11 mode enabled</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.4"><a class="anchor" href="#v1.4"></a><a class="link" href="#v1.4">v1.4 <sup>2014-02-27</sup></a></h3>
<div class="paragraph">
<p>Major release, featuring various new features, bug fixes and compatibility improvements.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Specification changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Documents without element nodes are now rejected with <code>status_no_document_element</code> error, unless <code>parse_fragment</code> option is used</p>
</li>
</ol>
</div>
</li>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Added XML fragment parsing (<code>parse_fragment</code> flag)</p>
</li>
<li>
<p>Added PCDATA whitespace trimming (<code>parse_trim_pcdata</code> flag)</p>
</li>
<li>
<p>Added long long support for <code>xml_attribute</code> and <code>xml_text</code> (<code>as_llong</code>, <code>as_ullong</code> and <code>set_value</code>/<code>set</code> overloads)</p>
</li>
<li>
<p>Added hexadecimal integer parsing support for <code>as_int</code>/<code>as_uint</code>/<code>as_llong</code>/<code>as_ullong</code></p>
</li>
<li>
<p>Added <code>xml_node::append_buffer</code> to improve performance of assembling documents from fragments</p>
</li>
<li>
<p><code>xml_named_node_iterator</code> is now bidirectional</p>
</li>
<li>
<p>Reduced XPath stack consumption during compilation and evaluation (useful for embedded systems)</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Improved support for platforms without wchar_t support</p>
</li>
<li>
<p>Fixed several false positives in clang static analysis</p>
</li>
<li>
<p>Fixed several compilation warnings for various GCC versions</p>
</li>
</ol>
</div>
</li>
<li>
<p>Bug fixes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fixed undefined pointer arithmetic in XPath implementation</p>
</li>
<li>
<p>Fixed non-seekable iostream support for certain stream types, i.e. Boost <code>file_source</code> with pipe input</p>
</li>
<li>
<p>Fixed <code>xpath_query::return_type</code> for some expressions</p>
</li>
<li>
<p>Fixed dllexport issues with <code>xml_named_node_iterator</code></p>
</li>
<li>
<p>Fixed <code>find_child_by_attribute</code> assertion for attributes with null name/value</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.2"><a class="anchor" href="#v1.2"></a><a class="link" href="#v1.2">v1.2 <sup>2012-05-01</sup></a></h3>
<div class="paragraph">
<p>Major release, featuring header-only mode, various interface enhancements (i.e. PCDATA manipulation and C&#43;&#43;11 iteration), many other features and compatibility improvements.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>New features:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Added <code>xml_text</code> helper class for working with PCDATA/CDATA contents of an element node</p>
</li>
<li>
<p>Added optional header-only mode (controlled by <code>PUGIXML_HEADER_ONLY</code> define)</p>
</li>
<li>
<p>Added <code>xml_node::children()</code> and <code>xml_node::attributes()</code> for C&#43;&#43;11 ranged for loop or <code>BOOST_FOREACH</code></p>
</li>
<li>
<p>Added support for Latin-1 (ISO-8859-1) encoding conversion during loading and saving</p>
</li>
<li>
<p>Added custom default values for <code>xml_attribute::as_*</code> (they are returned if the attribute does not exist)</p>
</li>
<li>
<p>Added <code>parse_ws_pcdata_single</code> flag for preserving whitespace-only PCDATA in case it&#8217;s the only child</p>
</li>
<li>
<p>Added <code>format_save_file_text</code> for <code>xml_document::save_file</code> to open files as text instead of binary (changes newlines on Windows)</p>
</li>
<li>
<p>Added <code>format_no_escapes</code> flag to disable special symbol escaping (complements <code>~parse_escapes</code>)</p>
</li>
<li>
<p>Added support for loading document from streams that do not support seeking</p>
</li>
<li>
<p>Added <code>PUGIXML_MEMORY_*</code> constants for tweaking allocation behavior (useful for embedded systems)</p>
</li>
<li>
<p>Added <code>PUGIXML_VERSION</code> preprocessor define</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Parser does not require setjmp support (improves compatibility with some embedded platforms, enables <code>/clr:pure</code> compilation)</p>
</li>
<li>
<p>STL forward declarations are no longer used (fixes SunCC/RWSTL compilation, fixes clang compilation in C&#43;&#43;11 mode)</p>
</li>
<li>
<p>Fixed AirPlay SDK, Android, Windows Mobile (WinCE) and C&#43;&#43;/CLI compilation</p>
</li>
<li>
<p>Fixed several compilation warnings for various GCC versions, Intel C&#43;&#43; compiler and Clang</p>
</li>
</ol>
</div>
</li>
<li>
<p>Bug fixes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fixed unsafe bool conversion to avoid problems on C&#43;&#43;/CLI</p>
</li>
<li>
<p>Iterator dereference operator is const now (fixes Boost <code>filter_iterator</code> support)</p>
</li>
<li>
<p><code>xml_document::save_file</code> now checks for file I/O errors during saving</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v1.0"><a class="anchor" href="#v1.0"></a><a class="link" href="#v1.0">v1.0 <sup>2010-11-01</sup></a></h3>
<div class="paragraph">
<p>Major release, featuring many XPath enhancements, wide character filename support, miscellaneous performance improvements, bug fixes and more.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>XPath:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>XPath implementation is moved to <code>pugixml.cpp</code> (which is the only source file now); use <code>PUGIXML_NO_XPATH</code> if you want to disable XPath to reduce code size</p>
</li>
<li>
<p>XPath is now supported without exceptions (<code>PUGIXML_NO_EXCEPTIONS</code>); the error handling mechanism depends on the presence of exception support</p>
</li>
<li>
<p>XPath is now supported without STL (<code>PUGIXML_NO_STL</code>)</p>
</li>
<li>
<p>Introduced variable support</p>
</li>
<li>
<p>Introduced new <code>xpath_query::evaluate_string</code>, which works without STL</p>
</li>
<li>
<p>Introduced new <code>xpath_node_set</code> constructor (from an iterator range)</p>
</li>
<li>
<p>Evaluation function now accept attribute context nodes</p>
</li>
<li>
<p>All internal allocations use custom allocation functions</p>
</li>
<li>
<p>Improved error reporting; now a last parsed offset is returned together with the parsing error</p>
</li>
</ol>
</div>
</li>
<li>
<p>Bug fixes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fixed memory leak for loading from streams with stream exceptions turned on</p>
</li>
<li>
<p>Fixed custom deallocation function calling with null pointer in one case</p>
</li>
<li>
<p>Fixed missing attributes for iterator category functions; all functions/classes can now be DLL-exported</p>
</li>
<li>
<p>Worked around Digital Mars compiler bug, which lead to minor read overfetches in several functions</p>
</li>
<li>
<p><code>load_file</code> now works with 2+ Gb files in MSVC/MinGW</p>
</li>
<li>
<p>XPath: fixed memory leaks for incorrect queries</p>
</li>
<li>
<p>XPath: fixed <code>xpath_node()</code> attribute constructor with empty attribute argument</p>
</li>
<li>
<p>XPath: fixed <code>lang()</code> function for non-ASCII arguments</p>
</li>
</ol>
</div>
</li>
<li>
<p>Specification changes:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>CDATA nodes containing <code>]]&gt;</code> are printed as several nodes; while this changes the internal structure, this is the only way to escape CDATA contents</p>
</li>
<li>
<p>Memory allocation errors during parsing now preserve last parsed offset (to give an idea about parsing progress)</p>
</li>
<li>
<p>If an element node has the only child, and it is of CDATA type, then the extra indentation is omitted (previously this behavior only held for PCDATA children)</p>
</li>
</ol>
</div>
</li>
<li>
<p>Additional functionality:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Added <code>xml_parse_result</code> default constructor</p>
</li>
<li>
<p>Added <code>xml_document::load_file</code> and <code>xml_document::save_file</code> with wide character paths</p>
</li>
<li>
<p>Added <code>as_utf8</code> and <code>as_wide</code> overloads for <code>std::wstring</code>/<code>std::string</code> arguments</p>
</li>
<li>
<p>Added DOCTYPE node type (<code>node_doctype</code>) and a special parse flag, <code>parse_doctype</code>, to add such nodes to the document during parsing</p>
</li>
<li>
<p>Added <code>parse_full</code> parse flag mask, which extends <code>parse_default</code> with all node type parsing flags except <code>parse_ws_pcdata</code></p>
</li>
<li>
<p>Added <code>xml_node::hash_value()</code> and <code>xml_attribute::hash_value()</code> functions for use in hash-based containers</p>
</li>
<li>
<p>Added <code>internal_object()</code> and additional constructor for both <code>xml_node</code> and <code>xml_attribute</code> for easier marshalling (useful for language bindings)</p>
</li>
<li>
<p>Added <code>xml_document::document_element()</code> function</p>
</li>
<li>
<p>Added <code>xml_node::prepend_attribute</code>, <code>xml_node::prepend_child</code> and <code>xml_node::prepend_copy</code> functions</p>
</li>
<li>
<p>Added <code>xml_node::append_child</code>, <code>xml_node::prepend_child</code>, <code>xml_node::insert_child_before</code> and <code>xml_node::insert_child_after</code> overloads for element nodes (with name instead of type)</p>
</li>
<li>
<p>Added <code>xml_document::reset()</code> function</p>
</li>
</ol>
</div>
</li>
<li>
<p>Performance improvements:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><code>xml_node::root()</code> and <code>xml_node::offset_debug()</code> are now O(1) instead of O(logN)</p>
</li>
<li>
<p>Minor parsing optimizations</p>
</li>
<li>
<p>Minor memory optimization for strings in DOM tree (<code>set_name</code>/<code>set_value</code>)</p>
</li>
<li>
<p>Memory optimization for string memory reclaiming in DOM tree (<code>set_name</code>/<code>set_value</code> now reallocate the buffer if memory waste is too big)</p>
</li>
<li>
<p>XPath: optimized document order sorting</p>
</li>
<li>
<p>XPath: optimized child/attribute axis step</p>
</li>
<li>
<p>XPath: optimized number-to-string conversions in MSVC</p>
</li>
<li>
<p>XPath: optimized concat for many arguments</p>
</li>
<li>
<p>XPath: optimized evaluation allocation mechanism: constant and document strings are not heap-allocated</p>
</li>
<li>
<p>XPath: optimized evaluation allocation mechanism: all temporaries' allocations use fast stack-like allocator</p>
</li>
</ol>
</div>
</li>
<li>
<p>Compatibility:</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Removed wildcard functions (<code>xml_node::child_w</code>, <code>xml_node::attribute_w</code>, etc.)</p>
</li>
<li>
<p>Removed <code>xml_node::all_elements_by_name</code></p>
</li>
<li>
<p>Removed <code>xpath_type_t</code> enumeration; use <code>xpath_value_type</code> instead</p>
</li>
<li>
<p>Removed <code>format_write_bom_utf8</code> enumeration; use <code>format_write_bom</code> instead</p>
</li>
<li>
<p>Removed <code>xml_document::precompute_document_order</code>, <code>xml_attribute::document_order</code> and <code>xml_node::document_order</code> functions; document order sort optimization is now automatic</p>
</li>
<li>
<p>Removed <code>xml_document::parse</code> functions and <code>transfer_ownership</code> struct; use <code>xml_document::load_buffer_inplace</code> and <code>xml_document::load_buffer_inplace_own</code> instead</p>
</li>
<li>
<p>Removed <code>as_utf16</code> function; use <code>as_wide</code> instead</p>
</li>
</ol>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="v0.9"><a class="anchor" href="#v0.9"></a><a class="link" href="#v0.9">v0.9 <sup>2010-07-01</sup></a></h3>
<div class="paragraph">
<p>Major release, featuring extended and improved Unicode support, miscellaneous performance improvements, bug fixes and more.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Major Unicode improvements:</p>
<div class="olist arabic">