doc/reference.html: Make XML_Parse promote XML_ParseBuffer

This commit is contained in:
Sebastian Pipping 2023-10-03 21:16:41 +02:00
parent 81a705b6ae
commit 1d3ee5133e

View file

@ -1123,6 +1123,30 @@ provided input has been parsed; only after <a href="#isFinal">the
concluding call</a> will all handler callbacks and parsing errors have
happened.
</p>
<p>
Simplified, <code>XML_Parse</code> can be considered a convenience wrapper
that is pairing calls
to <code><a href="#XML_GetBuffer">XML_GetBuffer</a></code>
and <code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code>
(when Expat is built with macro <code>XML_CONTEXT_BYTES</code>
defined to a positive value, which is both common and default).
<code>XML_Parse</code> is then functionally equivalent to calling
<code><a href="#XML_GetBuffer">XML_GetBuffer</a></code>,
<code>memcpy</code>, and
<code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code>.
</p>
<p>
To avoid double copying of the input, direct use of functions
<code><a href="#XML_GetBuffer">XML_GetBuffer</a></code> and
<code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code> is advised
for most production use, e.g.
if you're using <code>read</code> or similar functionality to fill your
buffers, fill directly into the buffer from
<code><a href="#XML_GetBuffer">XML_GetBuffer</a></code>,
then parse with <code><a href="#XML_ParseBuffer">XML_ParseBuffer</a></code>.
</p>
</div>
<h4 id="XML_ParseBuffer">XML_ParseBuffer</h4>