File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
simplexml /
tests /
simplexml_import_dom.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:01 2012 UTC (13 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,
v5_3_10,
HEAD
php
--TEST--
SimpleXML [interop]: simplexml_import_dom
--SKIPIF--
<?php if (!extension_loaded("simplexml")) die("skip"); ?>
<?php if (!extension_loaded("dom")) die("skip dom extension not loaded"); ?>
--FILE--
<?php
$dom = new domDocument;
$dom->load(dirname(__FILE__)."/book.xml");
if(!$dom) {
echo "Error while parsing the document\n";
exit;
}
$s = simplexml_import_dom($dom);
$books = $s->book;
foreach ($books as $book) {
echo "{$book->title} was written by {$book->author}\n";
}
?>
--EXPECT--
The Grapes of Wrath was written by John Steinbeck
The Pearl was written by John Steinbeck
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>