1--TEST-- 2DOM Comment : Basic Functionality 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6?> 7--FILE-- 8<?php 9 10$xml = <<< EOXML 11<?xml version="1.0" encoding="ISO-8859-1"?> 12<courses> 13 <!-- Hello World! --> 14</courses> 15EOXML; 16 17$dom = new DOMDocument(); 18$dom->loadXML($xml); 19$root = $dom->documentElement; 20var_dump($root->hasChildNodes()); 21$children = $root->childNodes; 22 23for ($index = 0; $index < $children->length; $index++) { 24 echo "--- child $index ---\n"; 25 $current = $children->item($index); 26 echo get_class($current), "\n"; 27 var_dump($current->textContent); 28} 29 30--EXPECTF-- 31bool(true) 32--- child 0 --- 33DOMText 34string(2) " 35 " 36--- child 1 --- 37DOMComment 38string(14) " Hello World! " 39--- child 2 --- 40DOMText 41string(1) " 42" 43 44