xref: /PHP-8.2/ext/xmlwriter/tests/OO_011.phpt (revision 74859783)
1--TEST--
2XMLWriter: libxml2 XML Writer, fullEndElement method
3--CREDITS--
4Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
5#testfest PHPSP on 2014-07-05
6--EXTENSIONS--
7xmlwriter
8--FILE--
9<?php
10
11$xw = new XMLWriter();
12$xw->openMemory();
13$xw->setIndent(TRUE);
14$xw->setIndentString('   ');
15$xw->startDocument('1.0', "UTF-8");
16$xw->startElement('root');
17$xw->startElementNS('ns1', 'child1', 'urn:ns1');
18$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&');
19$xw->writeElement('chars', "special characters: <>\"'&");
20$xw->endElement();
21$xw->startElement('empty');
22$xw->fullEndElement();
23$xw->fullEndElement();
24// Force to write and empty the buffer
25$output = $xw->flush(true);
26print $output;
27?>
28--EXPECT--
29<?xml version="1.0" encoding="UTF-8"?>
30<root>
31   <ns1:child1 ns1:att1="&lt;&gt;&quot;'&amp;" xmlns:ns1="urn:ns1">
32      <chars>special characters: &lt;&gt;&quot;'&amp;</chars>
33   </ns1:child1>
34   <empty></empty>
35</root>
36