Voting

: three plus four?
(Example: nine)

The Note You're Voting On

ingjetel at gmail dot com
10 years ago
Easy function for basic output of XML file via DOM parsing

<?php
$dom
= new DomDocument();
$dom->load("./file.xml") or die("error");
$start = $dom->documentElement;
fc($start);

function
fc($node) {
$child = $node->childNodes;
foreach(
$child as $item) {
if (
$item->nodeType == XML_TEXT_NODE) {
if (
strlen(trim($item->nodeValue))) echo trim($item->nodeValue)."<br/>";
}
else if (
$item->nodeType == XML_ELEMENT_NODE) fc($item);
}
}
?>

<< Back to user notes page

To Top