You're using (parenthesis) instead of [square brackets] for your indices. Try $authors->item[0]->nodeValue (et al.) instead.
You're using (parenthesis) instead of [square brackets] for your indices. Try $authors->item[0]->nodeValue (et al.) instead.
man... another fatal error : Fatal error: Cannot instantiate non-existent class: domdocument in /~/www/transparent.agilityhoster.com/test.php on line 2
wait. imma check...
<?php
$doc = new DOMDocument();
$doc->load( 'abc.xml' );
$books = $doc->getElementsByTagName( "book" );
foreach( $books as $book )
{
$authors = $book->getElementsByTagName( "author" );
$author = $authors->item[0]->nodeValue;
$publishers = $book->getElementsByTagName( "publisher" );
$publisher = $publishers->item[0]->nodeValue;
$titles = $book->getElementsByTagName( "title" );
$title = $titles->item[0]->nodeValue;
echo "$title - $author - $publisher\n";
}
?>
where are you testing this? does your host support php5 and libxml? DOMdocument can also be disabled deliberately by your host; check with them to see if it is enabled.
Sorry for the late reply, they only have PHP 4.2.3 so I went to another free web hosting site![]()
Bookmarks