XML::SimpleDB::ResourceSet - container for multiple documents or document fragments |
XML::SimpleDB::ResourceSet - container for multiple documents or document fragments
$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();
A container for resources, normally used when a query returns multiple document fragments.
Graham Seaman CPAN ID: GSEAMAN graham@opencollector.org
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.
XML::DB::Resource
Usage : $rs->addResource($resource)
Purpose : Store an additional resource
Argument : The resource to store
Returns : undef
Usage : $rs->clear()
Purpose : delete all current resources
Argument : None
Returns : undef
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
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.
Usage : $rs->getResource($no)
Purpose : returns resource at position $no
Argument : Integer position in array
Returns : Resource
Usage : $size = $rs->getSize()
Purpose : returns number of stored resources
Argument : None
Returns : Integer
Usage : $rs->removeResource($no)
Purpose : Removes Resource at position $no
Argument : Integer position
Returns : undef
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 |