Only to correct a very small error, but maybe difficult to find in che function GetContentAsString posted by someone in April 2005.
There was $anode-node_value() instead of $anode->node_value().
This is the right version:
<?php
function GetContentAsString($node) {
$st = "";
foreach ($node->child_nodes() as $cnode)
if ($cnode->node_type()==XML_TEXT_NODE)
$st .= $cnode->node_value();
else if ($cnode->node_type()==XML_ELEMENT_NODE) {
$st .= "<" . $cnode->node_name();
if ($attribnodes=$cnode->attributes()) {
$st .= " ";
foreach ($attribnodes as $anode)
$st .= $anode->node_name() . "='" .
$anode->node_value() . "'";
}
$nodeText = GetContentAsString($cnode);
if (empty($nodeText) && !$attribnodes)
$st .= " />"; // unary
else
$st .= ">" . $nodeText . "</" .
$cnode->node_name() . ">";
}
return $st;
}
?>