|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides access to XML resources stored in the database. An XMLResource can be accessed either as text XML or via the DOM or SAX APIs.
The default behavior for getContent and setContent is to work with XML data as text so these methods work onString
content. I.e. it is always
possible to do the following
if (resource instanceof XMLResource) {
String foo = (String)resource.getContent();
}
Field Summary | |
static java.lang.String |
RESOURCE_TYPE
|
Method Summary | |
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. |
void |
setContentAsDOM(org.w3c.dom.Node content)
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 interface org.xmldb.api.base.Resource |
getContent, getId, getParentCollection, getResourceType, setContent |
Field Detail |
public static final java.lang.String RESOURCE_TYPE
Method Detail |
public org.w3c.dom.Node getContentAsDOM() throws XMLDBException
Resource
as a DOM Node.
Node
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void setContentAsDOM(org.w3c.dom.Node content) throws XMLDBException
Resource
using a DOM Node as the
source.
content
- 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
ContentHandler
to parse the XML data from
the database for use in an application.
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() throws XMLDBException
Resource
using a SAX
ContentHandler
.
ContentHandler
that can be used to add content
into the Resource
.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |