Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.api.xmldb
Class BXXMLResource

    java.lang.Object
      org.basex.api.xmldb.BXXMLResource

All Implemented Interfaces:
  BXXMLDBText, Resource, XMLResource

    public final class BXXMLResource

extends java.lang.Object
implements XMLResource, BXXMLDBText

Implementation of the XMLResource Interface for the XMLDB:API.

Author:
  Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

Field Summary

Fields inherited from interface org.xmldb.api.modules.XMLResource
`RESOURCE_TYPE`

Fields inherited from interface org.basex.api.xmldb.BXXMLDBText
`CONFORMANCE_LEVEL, DBURI, ERR_BINARY, ERR_CONT, ERR_DOC, ERR_EMPTY, ERR_ID, ERR_INV, ERR_ITER, ERR_NSURI, ERR_PROP, ERR_RES, ERR_TYPE, ERR_UNKNOWN, ERR_URI, LOCALHOST, XMLDB, XMLDBURI`

Constructor Summary
`BXXMLResource(byte[] d, Collection c)` Constructor for generated results.
`BXXMLResource(Data d, int p, java.lang.String i, Collection c)` Standard constructor.
`BXXMLResource(Result res, int p, Collection c)` Constructor for query results.

Method Summary
`java.lang.Object` | `getContent()` Retrieves the content from the resource.
`org.w3c.dom.Node` | `getContentAsDOM()` Returns the content of the `Resource` as a DOM Node.
`void` | `getContentAsSAX(org.xml.sax.ContentHandler handler)` Allows you to use a `ContentHandler` to parse the XML data from the database for use in an application.
`java.lang.String` | `getDocumentId()` Returns the unique id for the parent document to this `Resource` or null if the `Resource` does not have a parent document.
`java.lang.String` | `getId()` Returns the unique id for this `Resource` or null if the `Resource` is anonymous.
`Collection` | `getParentCollection()` Returns the `Collection` instance that this resource is associated with.
`java.lang.String` | `getResourceType()` Returns the resource type for this Resource.
`void` | `setContent(java.lang.Object value)` Sets the content for this resource.
`void` | `setContentAsDOM(org.w3c.dom.Node cont)` Sets the content of the `Resource` using a DOM Node as the source.
`org.xml.sax.ContentHandler` | `setContentAsSAX()` Sets the content of the `Resource` using a SAX `ContentHandler`.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BXXMLResource

    public BXXMLResource(byte[] d,
                         Collection c)

  Constructor for generated results.

  Parameters:
    `d` - content data
    `c` - Collection

### BXXMLResource

    public BXXMLResource(Result res,
                         int p,
                         Collection c)

  Constructor for query results.

  Parameters:
    `res` - query result
    `p` - query counter
    `c` - Collection

### BXXMLResource

    public BXXMLResource(Data d,
                         int p,
                         java.lang.String i,
                         Collection c)

  Standard constructor.

  Parameters:
    `d` - data reference
    `p` - pre value
    `i` - id
    `c` - collection

Method Detail

### getParentCollection

    public Collection getParentCollection()

  Description copied from interface: `Resource`
  Returns the `Collection` instance that this resource is associated with. All resources must exist within the context of a `collection`.

  Specified by:
    `getParentCollection` in interface `Resource`
  Returns:
    the collection associated with the resource.

### getId

    public java.lang.String getId()

  Description copied from interface: `Resource`
  Returns the unique id for this `Resource` or null if the `Resource` is anonymous. The `Resource` will be anonymous if it is obtained as the result of a query.

  Specified by:
    `getId` in interface `Resource`
  Returns:
    the id for the Resource or null if no id exists.

### getResourceType

    public java.lang.String getResourceType()

  Description copied from interface: `Resource`
  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 `Resource`
  Returns:
    the resource type for the Resource.

### getContent

    public java.lang.Object getContent()
                                throws XMLDBException

  Description copied from interface: `Resource`
  Retrieves the content from the resource. The type of the content varies depending what type of resource is being used.

  Specified by:
    `getContent` in interface `Resource`
  Returns:
    the content of the resource.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### setContent

    public void setContent(java.lang.Object value)
                    throws XMLDBException

  Description copied from interface: `Resource`
  Sets the content for this resource. The type of content that can be set depends on the type of resource being used.

  Specified by:
    `setContent` in interface `Resource`
  Parameters:
    `value` - the content value to set for the resource.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getDocumentId

    public java.lang.String getDocumentId()
                                   throws XMLDBException

  Description copied from interface: `XMLResource`
  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.

  Specified by:
    `getDocumentId` in interface `XMLResource`
  Returns:
    the id for the parent document of this `Resource` or null if there is no parent document for this `Resource`.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getContentAsDOM

    public org.w3c.dom.Node getContentAsDOM()

  Description copied from interface: `XMLResource`
  Returns the content of the `Resource` as a DOM Node.

  Specified by:
    `getContentAsDOM` in interface `XMLResource`
  Returns:
    The XML content as a DOM `Node`

### setContentAsDOM

    public void setContentAsDOM(org.w3c.dom.Node cont)
                         throws XMLDBException

  Description copied from interface: `XMLResource`
  Sets the content of the `Resource` using a DOM Node as the source.

  Specified by:
    `setContentAsDOM` in interface `XMLResource`
  Parameters:
    `cont` - The new content value
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.
    `ErrorCodes.INVALID_RESOURCE` if the content value provided is null.
    `ErrorCodes.WRONG_CONTENT_TYPE` if the content provided in not a valid DOM `Node`.

### getContentAsSAX

    public void getContentAsSAX(org.xml.sax.ContentHandler handler)
                         throws XMLDBException

  Description copied from interface: `XMLResource`
  Allows you to use a `ContentHandler` to parse the XML data from the database for use in an application.

  Specified by:
    `getContentAsSAX` in interface `XMLResource`
  Parameters:
    `handler` - the SAX `ContentHandler` to use to handle the `Resource` content.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.
    `ErrorCodes.INVALID_RESOURCE` if the `ContentHandler` provided is null.

### setContentAsSAX

    public org.xml.sax.ContentHandler setContentAsSAX()

  Description copied from interface: `XMLResource`
  Sets the content of the `Resource` using a SAX `ContentHandler`.

  Specified by:
    `setContentAsSAX` in interface `XMLResource`
  Returns:
    a SAX `ContentHandler` that can be used to add content into the `Resource`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD