--- /dev/null
+--TEST--
+Testing DOMDocumentFragment::appendXML and DOMDocumentFragment::hasChildNodes
+--FILE--
+<?php
+$doc = new DOMDocument();
+
+$fragment = $doc->createDocumentFragment();
+if ($fragment->hasChildNodes()) {
+ echo "has child nodes\n";
+} else {
+ echo "has no child nodes\n";
+}
+$fragment->appendXML('<foo>bar</foo>');
+if ($fragment->hasChildNodes()) {
+ echo "has child nodes\n";
+} else {
+ echo "has no child nodes\n";
+}
+--EXPECT--
+has no child nodes
+has child nodes
--- /dev/null
+--TEST--
+DOMDocument::loadHTML
+--CREDITS--
+Frank Cassedanne franck@ouarz.net
+#London TestFest 2008
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+$doc->loadHTML("<html><body><p>Test<br></p></body></html>");
+echo $doc->saveHTML();
+?>
+--EXPECTF--
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html><body><p>Test<br></p></body></html>
--- /dev/null
+--TEST--
+DOMDocument::save Test basic function of save method
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+$doc = new DOMDocument('1.0');
+$doc->formatOutput = true;
+
+$root = $doc->createElement('book');
+
+$root = $doc->appendChild($root);
+
+$title = $doc->createElement('title');
+$title = $root->appendChild($title);
+
+$text = $doc->createTextNode('This is the title');
+$text = $title->appendChild($text);
+
+$temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+
+echo 'Wrote: ' . $doc->save($temp_filename) . ' bytes'; // Wrote: 72 bytes
+?>
+--CLEAN--
+<?php
+ $temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+ unlink($temp_filename);
+?>
+--EXPECTF--
+Wrote: 72 bytes
+
--- /dev/null
+--TEST--
+Test whether a node has child nodes: hasChildNodes()
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+
+/* Create an XML document
+ * with strcuture
+ * <book>
+ * <title>This is the title</title>
+ * </book>
+ * Check for child nodes of the <book>, <title> and This is the title
+ *
+*/
+
+$doc = new DOMDocument();
+
+$root = $doc->createElement('book');
+$doc->appendChild($root);
+
+$title = $doc->createElement('title');
+$root->appendChild($title);
+
+$text = $doc->createTextNode('This is the title');
+$title->appendChild($text);
+
+echo "Root has child nodes: ";
+var_dump($root->hasChildNodes());
+
+echo "Title has child nodes: ";
+var_dump($title->hasChildNodes());
+
+echo "Text has child nodes: ";
+var_dump($text->hasChildNodes());
+
+?>
+--EXPECTF--
+Root has child nodes: bool(true)
+Title has child nodes: bool(true)
+Text has child nodes: bool(false)
\ No newline at end of file
--- /dev/null
+--TEST--
+Replacing a child node
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--CREDITS--
+Matt Raines <matt@raines.me.uk>
+#London TestFest 2008
+--FILE--
+<?php
+$document = new DOMDocument();
+$document->loadXML('<?xml version="1.0" encoding="utf-8"?>
+<root><foo><bar/><baz/></foo><spam><eggs/><eggs/></spam></root>');
+
+// Replaces the child node oldChild with newChild in the list of children, and
+// returns the oldChild node.
+$parent = $document->getElementsByTagName('foo')->item(0);
+$new_child = $document->createElement('qux');
+$old_child = $parent->replaceChild($new_child, $parent->firstChild);
+echo "New child replaces old child:\n" . $document->saveXML();
+echo "Old child is returned:\n" . $old_child->tagName . "\n";
+
+// If the newChild is already in the tree, it is first removed.
+$parent = $document->getElementsByTagName('spam')->item(0);
+$parent->replaceChild($new_child, $parent->firstChild);
+echo "Existing child is removed from tree:\n" . $document->saveXML();
+
+// Children are inserted in the correct order.
+$new_child = $document->getElementsByTagName('spam')->item(0);
+$parent = $document->getElementsByTagName('foo')->item(0);
+$parent->replaceChild($new_child, $parent->firstChild);
+echo "Children are inserted in order:\n" . $document->saveXML();
+?>
+--EXPECT--
+New child replaces old child:
+<?xml version="1.0" encoding="utf-8"?>
+<root><foo><qux/><baz/></foo><spam><eggs/><eggs/></spam></root>
+Old child is returned:
+bar
+Existing child is removed from tree:
+<?xml version="1.0" encoding="utf-8"?>
+<root><foo><baz/></foo><spam><qux/><eggs/></spam></root>
+Children are inserted in order:
+<?xml version="1.0" encoding="utf-8"?>
+<root><foo><spam><qux/><eggs/></spam></foo></root>