Class: Xindice

  • Package: saf.XML
  • Author: John Luxford <lux@simian.ca>
  • Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
  • License: http://www.sitellite.org/index/license Simian Open Software License
  • Version: 0.8, 2002-11-27, $Id: Xindice.php,v 1.3 2007/10/06 00:06:30 lux Exp $
  • Access: public

An abstraction to the XML-RPC API of the Apache Xindice XML database.

Requires the Apache Xindice XML database and the XML-RPC API to connect to it,
available at http://xml.apache.org/xindice/ and
http://xindice-xmlrpc.sourceforge.net/ , respectively.

New in 0.8:
- Uses a new XML-RPC client library, was PEAR::XML_RPC, is now IXR (the Inutio
XML-RPC Library), which has a much clearer API, _actual_ documentation, and
doesn't require an RPCWrapper class to hide its API as PEAR::XML_RPC did.
- Added an $errno property to contain the faultCode if an error occurs.
- Added a _method() method to format the method calls based on the $handler
property and the actual method name to call.


Usage Example


<?php

$xdb 
= new Xindice ('http://localhost:4080/''db');

echo 
'<pre>';
foreach (
$xdb->listDocuments ('/db/employees') as $id) {
    echo 
htmlentities_compat ($xdb->getDocument ('/db/employees'$id)) . "\n\n";
}
echo 
'</pre>';

?>

Return to Top



Properties


$doc


$error

  • Access: public

The error message (faultString) if an error occurs.


$client

  • Access: public

The XML-RPC client object.


$errno

  • Access: public

The error number (faultCode) if an error occurs.

Return to Top



Methods


Xindice ($source = 'http://localhost:4080/', $handler = 'db')

  • Access: public

Constructor method.


_method ($name)

  • Access: public
  • Return: string

Returns a proper method request with the $handler from the
property of this class prepended if necessary.


createCollection ($parent, $name)

  • Access: public
  • Return: boolean

Creates the specified collection below the specified $parent
collection. Returns true on success, unlike XML-RPC messages, which
return 0 on success.


createIndexer ($collection, $index, $pattern)

  • Access: public
  • Return: integer

Creates a new index in the specified collection.


createNewOID ($collection)

  • Access: public
  • Return: string

Creates a new unique id for this collection. Returns the
new OID.


dropCollection ($collection)

  • Access: public
  • Return: integer

Deletes the specified collection.


dropIndexer ($collection, $index)

  • Access: public
  • Return: integer

Deletes the specified index.


getDocument ($collection, $id)

  • Access: public
  • Return: string

Retrieves the specified document.


getDocumentCount ($collection)

  • Access: public
  • Return: integer

Returns the number of documents in the specified collection.


insertDocument ($collection, $id, $content)

  • Access: public
  • Return: string

Inserts a document into the specified collection. Returns
the id of the inserted document.


listCollections ($collection)

  • Access: public
  • Return: array

Returns a list of collections within the specified collection.


listDocuments ($collection)

  • Access: public
  • Return: array

Returns a list of documents within the specified collection.


listIndexers ($collection)

  • Access: public
  • Return: array

Returns a list of indexers within the specified collection.


listXMLObjects ($collection)

  • Access: public
  • Return: array

Returns a list of XML objects within the specified collection.


queryCollection ($collection, $type, $query, $namespaces)

  • Access: public
  • Return: array

Queries the specified collection. $type is the type of
query to execute (valid types are 'XPath' and 'XUpdate'). $query
is the query to execute, in the proper syntax of the specified
$type. $namespaces is an associative array of namespace definitions.
The key is the prefix and the value is the namespace URI.


queryDocument ($collection, $type, $query, $namespaces, $id)

  • Access: public
  • Return: array

Queries the specified document.


removeDocument ($collection, $id)

  • Access: public
  • Return: integer

Deletes the specified document.


setDocument ($collection, $id, $content)

  • Access: public
  • Return: string

Sets a document in the specified collection. Must be called
after the document already exists.

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System