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--EXPECT-- 30bool(true) 31--- child 0 --- 32DOMText 33string(2) " 34 " 35--- child 1 --- 36DOMComment 37string(14) " Hello World! " 38--- child 2 --- 39DOMText 40string(1) " 41" 42