File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / dom / tests / dom_comment_basic.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:37 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
DOM Comment : Basic Functionality
--SKIPIF--
<?php
require_once('skipif.inc');
?>
--FILE--
<?php

$xml = <<< EOXML
<?xml version="1.0" encoding="ISO-8859-1"?>
<courses>
	<!-- Hello World! -->
</courses>
EOXML;

$dom = new DOMDocument();
$dom->loadXML($xml);
$root = $dom->documentElement;
var_dump($root->hasChildNodes());
$children = $root->childNodes;

for ($index = 0; $index < $children->length; $index++) {
	echo "--- child $index ---\n";
	$current = $children->item($index);
	echo get_class($current), "\n";
	var_dump($current->textContent);
}

--EXPECTF--
bool(true)
--- child 0 ---
DOMText
string(2) "
	"
--- child 1 ---
DOMComment
string(14) " Hello World! "
--- child 2 ---
DOMText
string(1) "
"


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>