Exemple #1
0
include "XMLBuilder.class.php";
// Create an XML object for the XML file.
$xml = new XMLBuilder("government.xml");
// Check whether a search term was given.
if (!empty($term)) {
    // Only select those persons, in whose name or position
    // the search string is present.
    $government = $xml->evaluate("//person/*[contains(., {$term})]/..");
} else {
    // Select all members of the government.
    $government = $xml->evaluate("//person");
}
// Run through all members of the government.
foreach ($government as $person) {
    // Retrieve information about the person.
    $surname = $xml->get_content($person . "/surname[1]");
    $prename = $xml->get_content($person . "/prename[1]");
    $party = $xml->get_content($person . "/party[1]");
    $position = $xml->get_content($person . "/position[1]");
    // Display the information.
    ?>
                
                <tr>
                  <td><?php 
    echo $surname;
    ?>
</td>
                  <td><?php 
    echo $prename;
    ?>
</td>