topical media & game development
server-php-xml-class-xindice-test.php / php
<?
// PLEASE CHANGE THIS TO POINT TO YOUR XINDICE SERVER
port=4080;
xi=new Xindice("port);
if(!xi->setXmlRpcDebug(0);
// Create a collection "pepe" under db
base,"pepe");
// Insert a sample document there
xi->insertDocument("a_doc);
// List collections under base, should be an Array with "system" and "pepe"
xi->listCollections(base:</td></tr>");
foreach(col) {
print("<tr><td>Collection</td><td>tot=base."/pepe");
print("<table width='600' bgcolor='#ccccff' border='1' bordercolor='#000000'><tr><td bgcolor='#9999cc'>Documents in tot</td></tr>");
if(docs=base."/pepe");
print("<table width='600' bgcolor='#ccccff' border='1' bordercolor='#000000'><tr><td colspan='2' bgcolor='#9999cc'>Documents in tot</td></tr>");
foreach(doc) {
print("<tr><td>Document</td><td>cosa=base."/pepe","cosa");
print("<table width='600' bgcolor='#ccccff' border='1' bordercolor='#000000'><tr><td bgcolor='#9999cc'>Document cosa:</td></tr>");
print("<tr><td><textarea rows='11' cols='40'>xi->removeDocument(tot=base."/pepe");
print("<table width='600' bgcolor='#ccccff' border='1' bordercolor='#000000'><tr><td bgcolor='#9999cc'>Documents in tot</td></tr>");
if(xi->insertDocument(cosa);
// Make an Xpath query on the collection
xi->queryCollection(query</textarea></td></tr></table>");
print("<br />");
// And the document
xi->queryDocument(query</textarea></td></tr></table>");
print("<br />");
// An Xupdate modification
query=base."/pepe","XUpdate","cosa=cosa</textarea></td></tr></table>");
print("<br />");
// Drop the test collection
//base."/pepe");
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.