Exemple #1
0
// Check whether a file and a expression was given.
if (!empty($file) && !empty($expression)) {
    // Display a separator.
    echo "<br><hr><br>";
    // Include the <phpXML/> class.
    include "XMLBuilder.class.php";
    // Now create a new object for accessing the XML file.
    $xml = new XMLBuilder($file);
    // Evaluate the XPath expression.
    $results = $xml->evaluate($expression, $context);
    // Now check what action to perform.
    if ($action == "remove") {
        // Run through all nodes that were found.
        foreach ($results as $result) {
            // Remove the node.
            $xml->remove_node($result);
        }
        // Clear the results.
        $results = array();
    }
    // Now display the content of the XML file.
    echo "<pre>";
    echo $xml->get_file($results);
    echo "</pre>";
}
?>
    </td>
  </tr>
  <tr>
    <td class="content">
      <hr>