Location: PHPKode > scripts > RDF API > rdf-api/test/serializeroptions.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title>Test Serializer Options</title>
</head>
<body>

<?php
define("RDFAPI_INCLUDE_DIR", "./../api/");
include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");

// This is the URI of the document to be dumped
$base="C:/OpenSA/Apache/htdocs/rdf_api/test/example2.rdf";

// Create new Parser 
$parser = new RdfParser();

// Parse document
$model =& $parser->generateModel($base);

// Output as Table
RDFUtil::writeHTMLTable($model);
echo "<P>";

			  
// Create Serializer and serialize model to RDF with default configuration
$ser = new RDFSerializer();
$rdf =& $ser->serialize($model);
echo "<p><textarea cols='110' rows='20'>" . $rdf . "</textarea>";

// Serialize model to RDF using attributes
$ser->configUseAttributes(TRUE);
$rdf =& $ser->serialize($model);
echo "<p><textarea cols='110' rows='20'>" . $rdf . "</textarea>";
$ser->configUseAttributes(FALSE);
 
// Serialize model to RDF using entities
$ser->configUseEntities(TRUE);
$rdf =& $ser->serialize($model);
echo "<p><textarea cols='110' rows='30'>" . $rdf . "</textarea>";
$ser->configUseEntities(FALSE);

// Serialize model to RDF without qnames for RDF tags
$ser->configUseQnames(FALSE);
$rdf =& $ser->serialize($model);
echo "<p><textarea cols='110' rows='20'>" . $rdf . "</textarea>";
$ser->configUseQnames(TRUE);

 


?>



</body>
</html>
Return current item: RDF API