Xindice API
version 1.1

org.apache.xindice.client.xmldb.resources
Class XMLResourceImpl

java.lang.Object
  |
  +--org.apache.xindice.client.xmldb.resources.XMLResourceImpl
All Implemented Interfaces:
org.xmldb.api.base.Resource, org.xmldb.api.modules.XMLResource

public class XMLResourceImpl
extends Object
implements org.xmldb.api.modules.XMLResource

XMLResourceImpl provides an implementation to handle XML resources and convert easily between Text, DOM or SAX presentations.

Version:
$Revision: 511426 $, $Date: 2007-02-24 22:25:02 -0500 (Sat, 24 Feb 2007) $

Field Summary
protected  org.xmldb.api.base.Collection collection
           
protected  String content
           
protected  String documentId
           
protected  String id
           
static String SAX_NAMESPACE_PREFIXES_FEATURE
          This is a SAX feature that controls how namespaces are reported in SAX.
static String SAX_NAMESPACES_FEATURE
          This is a SAX feature that controls how namespaces are reported in SAX.
 
Fields inherited from interface org.xmldb.api.modules.XMLResource
RESOURCE_TYPE
 
Constructor Summary
XMLResourceImpl(String id, org.xmldb.api.base.Collection collection)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(String id, org.xmldb.api.base.Collection collection, String content)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(String id, org.xmldb.api.base.Collection collection, SymbolTable syms, byte[] bytes)
          Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
XMLResourceImpl(String id, String documentId, org.xmldb.api.base.Collection collection)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(String id, String documentId, org.xmldb.api.base.Collection collection, String content)
          Constructor for the XMLResourceImpl object
XMLResourceImpl(String id, String documentId, org.xmldb.api.base.Collection collection, SymbolTable syms, byte[] bytes)
          Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
 
Method Summary
 Object getContent()
          Gets the content of the XMLResourceImpl object
 org.w3c.dom.Node getContentAsDOM()
          Returns the content of the resource as a DOM Node.
 void getContentAsSAX(org.xml.sax.ContentHandler handler)
          getContentAsSAX enables retrieving of the content via the use of a SAX ContentHandler.
 String getDocumentId()
          Returns the unique id for the parent document to this Resource or null if the Resource does not have a parent document.
 String getId()
          Gets the Id attribute of the XMLResourceImpl object
 org.xmldb.api.base.Collection getParentCollection()
          Gets the parent Collection instance for this resource
 String getResourceType()
          Returns the resource type for this Resource.
 boolean getSAXFeature(String feature)
          Retrieves whether a SAX feature will be active for the SAX generated by the getContentAsSAX() method.
 void setContent(Object value)
          Sets the Content attribute of the XMLResourceImpl object.
 void setContentAsDOM(org.w3c.dom.Node content)
          Sets the content of the resource from a DOM Node.
 org.xml.sax.ContentHandler setContentAsSAX()
          setContentAsSAX returns a SAX ContentHandler that can be used to set the content of the resource.
 void setId(String name)
           
 void setSAXFeature(String feature, boolean value)
          Allows SAX feature to be set for the SAX that is generated by getContentAsSAX.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAX_NAMESPACES_FEATURE

public static final String SAX_NAMESPACES_FEATURE
This is a SAX feature that controls how namespaces are reported in SAX. By default this feature is on.
See Also:
sax.sourceforge.net/?selected=namespaces

SAX_NAMESPACE_PREFIXES_FEATURE

public static final String SAX_NAMESPACE_PREFIXES_FEATURE
This is a SAX feature that controls how namespaces are reported in SAX. By default this feature is off.
See Also:
sax.sourceforge.net/?selected=namespaces

id

protected String id

documentId

protected String documentId

collection

protected org.xmldb.api.base.Collection collection

content

protected String content
Constructor Detail

XMLResourceImpl

public XMLResourceImpl(String id,
                       org.xmldb.api.base.Collection collection)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource

XMLResourceImpl

public XMLResourceImpl(String id,
                       String documentId,
                       org.xmldb.api.base.Collection collection)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
documentId - The parent document id associated with this resource
collection - the parent collection for the resource

XMLResourceImpl

public XMLResourceImpl(String id,
                       org.xmldb.api.base.Collection collection,
                       String content)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource
content - the content to associate with the resource

XMLResourceImpl

public XMLResourceImpl(String id,
                       String documentId,
                       org.xmldb.api.base.Collection collection,
                       String content)
Constructor for the XMLResourceImpl object
Parameters:
id - The unique id associated with this resource
documentId - The parent document id associated with this resource
collection - the parent collection for the resource
content - the content to associate with the resource

XMLResourceImpl

public XMLResourceImpl(String id,
                       String documentId,
                       org.xmldb.api.base.Collection collection,
                       SymbolTable syms,
                       byte[] bytes)
Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource
bytes - the content to associate with the resource

XMLResourceImpl

public XMLResourceImpl(String id,
                       org.xmldb.api.base.Collection collection,
                       SymbolTable syms,
                       byte[] bytes)
Constructor for the XMLResourceImpl object used in conjunction with Wire Compression
Parameters:
id - The unique id associated with this resource
collection - the parent collection for the resource
bytes - the content to associate with the resource
Method Detail

setSAXFeature

public void setSAXFeature(String feature,
                          boolean value)
Allows SAX feature to be set for the SAX that is generated by getContentAsSAX.
Specified by:
setSAXFeature in interface org.xmldb.api.modules.XMLResource
Parameters:
feature - feature name. Currently supported features are namespace reporting features described in the specification.
value - turn feature on or off.
See Also:
sax.sourceforge.net/?selected=namespaces

getSAXFeature

public boolean getSAXFeature(String feature)
Retrieves whether a SAX feature will be active for the SAX generated by the getContentAsSAX() method.
Specified by:
getSAXFeature in interface org.xmldb.api.modules.XMLResource
Parameters:
feature - feature name. Currently supported features are namespace reporting features described in the specification
Returns:
whether the feature is on or off
See Also:
sax.sourceforge.net/?selected=namespaces

getDocumentId

public String getDocumentId()
                     throws org.xmldb.api.base.XMLDBException
Returns the unique id for the parent document to this Resource or null if the Resource does not have a parent document.
Specified by:
getDocumentId in interface org.xmldb.api.modules.XMLResource
Returns:
the id for the parent document of this Resource or null if there is no parent document for this Resource.
Throws:
org.xmldb.api.base.XMLDBException -  

setContent

public void setContent(Object value)
                throws org.xmldb.api.base.XMLDBException
Sets the Content attribute of the XMLResourceImpl object. The value being set must be String object containing well formed XML text.
Specified by:
setContent in interface org.xmldb.api.base.Resource
Parameters:
value - The new Content value
Throws:
org.xmldb.api.base.XMLDBException -  

setContentAsDOM

public void setContentAsDOM(org.w3c.dom.Node content)
                     throws org.xmldb.api.base.XMLDBException
Sets the content of the resource from a DOM Node.
Specified by:
setContentAsDOM in interface org.xmldb.api.modules.XMLResource
Parameters:
content - Node containing the new content.
Throws:
org.xmldb.api.base.XMLDBException -  

setContentAsSAX

public org.xml.sax.ContentHandler setContentAsSAX()
                                           throws org.xmldb.api.base.XMLDBException
setContentAsSAX returns a SAX ContentHandler that can be used to set the content of the resource.
Specified by:
setContentAsSAX in interface org.xmldb.api.modules.XMLResource
Returns:
The ContentHandler that is used to insert data into the database.
Throws:
org.xmldb.api.base.XMLDBException -  

getParentCollection

public org.xmldb.api.base.Collection getParentCollection()
                                                  throws org.xmldb.api.base.XMLDBException
Gets the parent Collection instance for this resource
Specified by:
getParentCollection in interface org.xmldb.api.base.Resource
Returns:
The ParentCollection value
Throws:
org.xmldb.api.base.XMLDBException -  

getResourceType

public String getResourceType()
                       throws org.xmldb.api.base.XMLDBException
Returns the resource type for this Resource.

XML:DB defined resource types are:

XMLResource - all XML data stored in the database
BinaryResource - Binary blob data stored in the database

Specified by:
getResourceType in interface org.xmldb.api.base.Resource
Returns:
the resource type for the Resource.
Throws:
org.xmldb.api.base.XMLDBException -  

getId

public String getId()
             throws org.xmldb.api.base.XMLDBException
Gets the Id attribute of the XMLResourceImpl object
Specified by:
getId in interface org.xmldb.api.base.Resource
Returns:
The Id value
Throws:
org.xmldb.api.base.XMLDBException -  

getContent

public Object getContent()
                  throws org.xmldb.api.base.XMLDBException
Gets the content of the XMLResourceImpl object
Specified by:
getContent in interface org.xmldb.api.base.Resource
Returns:
The Content value
Throws:
org.xmldb.api.base.XMLDBException -  

getContentAsDOM

public org.w3c.dom.Node getContentAsDOM()
                                 throws org.xmldb.api.base.XMLDBException
Returns the content of the resource as a DOM Node.
Specified by:
getContentAsDOM in interface org.xmldb.api.modules.XMLResource
Returns:
The content as a DOM node
Throws:
org.xmldb.api.base.XMLDBException -  

getContentAsSAX

public void getContentAsSAX(org.xml.sax.ContentHandler handler)
                     throws org.xmldb.api.base.XMLDBException
getContentAsSAX enables retrieving of the content via the use of a SAX ContentHandler.
Specified by:
getContentAsSAX in interface org.xmldb.api.modules.XMLResource
Parameters:
handler - The ContentHandler to use.
Throws:
org.xmldb.api.base.XMLDBException -  

setId

public void setId(String name)

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.