S
Skeets
using php5 and given the code at the bottom of this post, this code
works to print the expected value:
foreach ($entry1 as $entry) {
echo "Found {$entry->nodeValue}</br";
}
// prints "Found My List"
however, this code does not work:
echo "Found {$entry->nodeValue}</br";
// prints "Found"
how come?
what can i do to isolate the element text value without the foreach
loop? i've tried absolutely everying that i can think of without any
good results.
tia....
----code----
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$doc->Load('default_conf/book.xml');
$xpath = new DOMXPath($doc);
$query1 = '//book/title';
$entry1 = $xpath->query($query1);
foreach ($entry1 as $entry) {
echo "Found {$entry->nodeValue}</br";
}
works to print the expected value:
foreach ($entry1 as $entry) {
echo "Found {$entry->nodeValue}</br";
}
// prints "Found My List"
however, this code does not work:
echo "Found {$entry->nodeValue}</br";
// prints "Found"
how come?
what can i do to isolate the element text value without the foreach
loop? i've tried absolutely everying that i can think of without any
good results.
tia....
----code----
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$doc->Load('default_conf/book.xml');
$xpath = new DOMXPath($doc);
$query1 = '//book/title';
$entry1 = $xpath->query($query1);
foreach ($entry1 as $entry) {
echo "Found {$entry->nodeValue}</br";
}