XML::SimpleDB::ResourceSet - container for multiple documents or document fragments


NAME

XML::SimpleDB::ResourceSet - container for multiple documents or document fragments


SYNOPSIS

$collection = $dbm->getCollection(``xmldb:$driver:$url/db/test/shakespeare''); $service = $collection->getService('XPathQueryService', '1.0'); $resourceSet = $service->query('//TITLE'); $id = 'hamlet.xml'; $resourceSet->addResource($collection->getResource($id)); $n = $resourceSet->getSize(); $resource = $resourceSet->getResource($n-1); $resourceSet->removeResource($n); $aref = $resourceSet->getIterator(); foreach(@{$aref)){ $xml = $_->getContent(); } $resourceSet->clear();


DESCRIPTION

A container for resources, normally used when a query returns multiple document fragments.


BUGS


AUTHOR

        Graham Seaman
        CPAN ID: GSEAMAN
        graham@opencollector.org


COPYRIGHT

Copyright (c) 2002 Graham Seaman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.


SEE ALSO

XML::DB::Resource


PUBLIC METHODS

addResource

Usage : $rs->addResource($resource)

Purpose : Store an additional resource

Argument : The resource to store

Returns : undef

clear

Usage : $rs->clear()

Purpose : delete all current resources

Argument : None

Returns : undef

getIterator

Usage : $rs->getIterator()

Purpose : Should return an iterator; just returns an array reference (foreach is an iterator, isnt it?)

Argument : None

Returns : array reference to resources

getMembersAsResource

Usage : $xml = $rs->getMembersAsResource()

Purpose : Returns a resource with an xml reprentation of contents

Argument : none

Returns : Resource

Comment : Not defined; the xml format is not yet defined in the spec. Need to check if Xindice or eXist have chosen to implement this.

getResource

Usage : $rs->getResource($no)

Purpose : returns resource at position $no

Argument : Integer position in array

Returns : Resource

getSize

Usage : $size = $rs->getSize()

Purpose : returns number of stored resources

Argument : None

Returns : Integer

removeResource

Usage : $rs->removeResource($no)

Purpose : Removes Resource at position $no

Argument : Integer position

Returns : undef

new

Purpose : Constructor

Comments : The constructor should not be called directly; new ResourceSets are created as a result of an XPathQuery.

 XML::SimpleDB::ResourceSet - container for multiple documents or document fragments