xref: /PHP-8.0/ext/xmlwriter/tests/OO_011.phpt (revision 74235ca5)
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--SKIPIF--
7<?php
8if (!extension_loaded("xmlwriter")) die("skip");
9?>
10--FILE--
11<?php
12
13$xw = new XMLWriter();
14$xw->openMemory();
15$xw->setIndent(TRUE);
16$xw->setIndentString('   ');
17$xw->startDocument('1.0', "UTF-8");
18$xw->startElement('root');
19$xw->startElementNS('ns1', 'child1', 'urn:ns1');
20$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&');
21$xw->writeElement('chars', "special characters: <>\"'&");
22$xw->endElement();
23$xw->startElement('empty');
24$xw->fullEndElement();
25$xw->fullEndElement();
26// Force to write and empty the buffer
27$output = $xw->flush(true);
28print $output;
29?>
30--EXPECT--
31<?xml version="1.0" encoding="UTF-8"?>
32<root>
33   <ns1:child1 ns1:att1="&lt;&gt;&quot;'&amp;" xmlns:ns1="urn:ns1">
34      <chars>special characters: &lt;&gt;&quot;'&amp;</chars>
35   </ns1:child1>
36   <empty></empty>
37</root>
38