1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
--TEST--
Bug #41287 (Writing empty tags with Xmlwriter::WriteElement[ns])
--SKIPIF--
<?php
if (!extension_loaded("xmlwriter")) die("skip");
?>
--FILE--
<?php
$xml = new XmlWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument();
$xml->startElement('test');
$xml->writeElement('foo', null);
$xml->writeElement('foo2', "");
$xml->writeElement('foo3');
$xml->startElement('bar');
$xml->endElement('bar');
$xml->endElement();
print $xml->flush(true);
print "\n";
$xw = new XMLWriter();
$xw->openMemory();
$xw->setIndent(true);
$xw->startDocument();
$xw->startElementNS('test', 'test', 'urn:x-test:');
$xw->writeElementNS('test', 'foo', null, '');
$xw->writeElementNS(null, 'bar', 'urn:x-test:', '');
$xw->writeElementNS(null, 'bar', 'urn:x-test:', NULL);
$xw->writeElementNS(null, 'bar', 'urn:x-test:');
$xw->writeElementNS(null, 'bar', '', '');
$xw->endElement();
$xw->endDocument();
print $xw->flush(true);
?>
--EXPECTF--
<?xml version="1.0"?>
<test>
<foo/>
<foo2></foo2>
<foo3/>
<bar/>
</test>
<?xml version="1.0"?>
<test:test xmlns:test="urn:x-test:">
<test:foo></test:foo>
<bar xmlns="urn:x-test:"></bar>
<bar xmlns="urn:x-test:"/>
<bar xmlns="urn:x-test:"/>
<bar xmlns=""></bar>
</test:test>
|