Source for file example2.php
Documentation is available at example2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>XML_FOAF_Parser Example</title>
<meta name="Author" content="" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
table,th,td { border: 1px solid black; }
// Get our FOAF File from $_GET['foaf']
if (!isset ($_REQUEST['foaf'])) {
echo "<strong>Please enter a FOAF file below";
// Require the XML_FOAF_Parser class
require_once 'XML/FOAF/Parser.php';
// Create new Parser object
echo '<h1>XML_FOAF_Parser Example</h1>';
if (isset ($_REQUEST['xml'])) {
// Parser our FOAF in $foaf
require_once 'Benchmark/Timer.php';
$timer = new Benchmark_Timer ();
$parser->parseFromMem ($foaf);
$timer->setMarker ('Time taken to Parse FOAF File');
if (isset ($_REQUEST['table'])) {
// Show our FOAF as an HTML table
echo "<h2>FOAF as HTML Table</h2>";
echo $parser->toHTML ($parser->toArray ());
if (isset ($_REQUEST['array'])) {
// Show the contents of the FOAF Data array
echo "<h2>FOAF as Array</h2>";
if (isset ($_REQUEST['timer'])) {
<form method="post" action=" <?php echo $_SERVER['PHP_SELF']; ?>">
<label>FOAF File URI: <input type="text" name="foaf" value=" <?php echo (@$_REQUEST['foaf']) ?>" /></label>
Show RDF/XML: <input type="checkbox" name="xml" value="true" />
Show as HTML Table: <input type="checkbox" name="table" value="true" checked="checked" />
Show as Array: <input type="checkbox" name="array" value="true" />
Show Timer: <input type="checkbox" name="timer" value="true" checked="checked" />
<input type="submit" value="Parse FOAF!" />
Documentation generated on Mon, 11 Mar 2019 15:47:54 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|