XML::DB::Resource::XMLResource - Wrapper class for xml documents or document fragments


NAME

XML::DB::Resource::XMLResource - Wrapper class for xml documents or document fragments


SYNOPSIS

$resource = $collection->getResource($id); $dom = $resource->getContentAsDOM(); $resource->setContentAsDOM($dom); $resource->getDocumentId();


DESCRIPTION

This class implements the Resource interface from the XML:DB base specification.


BUGS

No implementation of SAX interface


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

getContentAsDOM

Usage : $r->getContentAsDOM()

Purpose : Returns the stored data as a DOM node

Argument : None

Returns : DOM node

setContentAsDOM

Usage : $r->setContentAsDOM($dom)

Purpose : Stores the DOM node

Argument : DOM node

Returns : undef

getContentAsSAX

Usage : $saxHandler = $r->getContentAsSAX()

Purpose : Returns a SAX handler for the stored data

Argument : None

Returns : SAX handler

setContentAsSAX

Usage : $r->setContentAsSAX($saxHandler)

Purpose : Stores contents created by the SAX handler

Argument : SAX handler

Returns : undef

getDocumentId

Usage : $r->getDocumentId()

Purpose : Returns the unique id for the parent document to this Resource or null if the Resource does not have a parent document. getDocumentId() is typically used with Resource instances retrieved using a query. It enables accessing the parent document of the Resource even if the Resource is a child node of the document. If the Resource was not obtained through a query then getId() and getDocumentId() will return the same id.

Argument : None

Returns : documentId, Id or undef

new

Purpose : Constructor

Comments : The constructor should not be called directly; new Resources are created via their parent Collection, or implicitly while building a ResourceSet.


Methods not in the XML:DB API

getContentAsHTML

Usage : $r->getContentAsHTML()

Purpose : Returns the stored data with angle brackets escaped

Argument : None

Returns : HTML-viewable string

Comments : What about pretty-printing? This just adds line breaks. And what about all the other entities? And non ASCII chars? :-(

 XML::DB::Resource::XMLResource - Wrapper class for xml documents or document fragments