1--TEST--
2DOMNode::normalize() advanced
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = new DOMDocument;
9$root = $dom->appendChild($dom->createElement("root"));
10$child1 = $root->appendChild($dom->createElement("child1"));
11$child2 = $root->appendChild($dom->createElement("child2"));
12
13$child1->appendChild($dom->createTextNode("abc"));
14$child1->appendChild($dom->createTextNode(""));
15$child1->appendChild($dom->createTextNode("def"));
16
17$child2->appendChild($dom->createTextNode(""));
18$child2->setAttribute("foo", "bar");
19
20echo $dom->saveXML();
21
22$root->normalize();
23
24var_dump($child1->childNodes[0]->textContent);
25var_dump($child2->childNodes[0]);
26
27?>
28--EXPECT--
29<?xml version="1.0"?>
30<root><child1>abcdef</child1><child2 foo="bar"></child2></root>
31string(6) "abcdef"
32NULL
33