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