<?php
$xmlDoc = new DOMDocument('1.0', 'UTF-8');
$xmlDoc->load('note.XML');
$x = $xmlDoc->documentElement;
//var_export($x);
foreach ($x->childNodes AS $item) {
//echo $item->nodeName . PHP_EOL;
//echo $item->nodeValue . PHP_EOL;
//echo $item->getAttribute('newsid') . PHP_EOL;
//echo $item->getAttribute('newstitle') . PHP_EOL;
//echo $x->childNodes->item($child1)->nodeName . ' = ';
//echo $x->childNodes->item($child1)->getAttribute('newsid') . PHP_EOL;
}
unset($x);
unset($xmlDoc);
?>
<?php
$xmlDoc = new DOMDocument('1.0', 'UTF-8');
$xmlDoc->load('note.XML');
$x = $xmlDoc->documentElement;
//var_export($x);
foreach ($x->childNodes AS $item) {
$Headline = $value->getElementsByTagName("Headline");
$Headline = $Headline->item(0)->nodeValue;
$BODY = $value->getElementsByTagName("BODY");
$BODY = $BODY->item(0)->nodeValue;
echo $Headline . " :: " . $BODY . "
";
}
unset($x);
unset($xmlDoc);
?>
No comments:
Post a Comment