|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.api.xmldb.BXXMLResource
public final class BXXMLResource
Implementation of the XMLResource Interface for the XMLDB:API.
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 |
---|
public BXXMLResource(byte[] d, Collection c)
d
- content datac
- Collectionpublic BXXMLResource(Result res, int p, Collection c)
res
- query resultp
- query counterc
- Collectionpublic BXXMLResource(Data d, int p, java.lang.String i, Collection c)
d
- data referencep
- pre valuei
- idc
- collectionMethod Detail |
---|
public Collection getParentCollection()
Resource
Collection
instance that this resource is
associated with. All resources must exist within the context of a
collection
.
getParentCollection
in interface Resource
public java.lang.String getId()
Resource
Resource
or null if the
Resource
is anonymous. The Resource
will be
anonymous if it is obtained as the result of a query.
getId
in interface Resource
public java.lang.String getResourceType()
Resource
getResourceType
in interface Resource
public java.lang.Object getContent() throws XMLDBException
Resource
getContent
in interface Resource
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void setContent(java.lang.Object value) throws XMLDBException
Resource
setContent
in interface Resource
value
- the content value to set for the resource.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public java.lang.String getDocumentId() throws XMLDBException
XMLResource
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.
getDocumentId
in interface XMLResource
Resource
or
null if there is no parent document for this Resource
.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public org.w3c.dom.Node getContentAsDOM()
XMLResource
Resource
as a DOM Node.
getContentAsDOM
in interface XMLResource
Node
public void setContentAsDOM(org.w3c.dom.Node cont) throws XMLDBException
XMLResource
Resource
using a DOM Node as the
source.
setContentAsDOM
in interface XMLResource
cont
- The new content value
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
.public void getContentAsSAX(org.xml.sax.ContentHandler handler) throws XMLDBException
XMLResource
ContentHandler
to parse the XML data from
the database for use in an application.
getContentAsSAX
in interface XMLResource
handler
- the SAX ContentHandler
to use to handle the
Resource
content.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.INVALID_RESOURCE
if the
ContentHandler
provided is null.public org.xml.sax.ContentHandler setContentAsSAX()
XMLResource
Resource
using a SAX
ContentHandler
.
setContentAsSAX
in interface XMLResource
ContentHandler
that can be used to add content
into the Resource
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |