Fix #74492: XMLWriter adds indent between mixed child nodes

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351014 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2020-10-27 13:28:37 +00:00
parent 8d11b029ad
commit 48f89dadf5

View file

@ -48,6 +48,42 @@
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="xmlwriter-set-indent.example.mixed-content">
<title><methodname>XMLWriter::setIndent</methodname> and mixed Content</title>
<para>
Enabling indentation is not suitable for mixed content, because the indent
string is also inserted before inline elements.
</para>
<programlisting role="php">
<![CDATA[
<?php
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(2);
$writer->startDocument();
$writer->startElement('p');
$writer->text('before');
$writer->writeElement('a', 'element');
$writer->text('after');
$writer->endElement();
$writer->endDocument();
echo $writer->outputMemory();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<?xml version="1.0"?>
<p>before <a>element</a>
after</p>
]]>
</screen>
</example>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>