|
XML:DB API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xmldb.api.sdk.modules.BaseResource
org.xmldb.api.sdk.modules.SimpleXMLResource
public abstract class SimpleXMLResource
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.
Field Summary |
---|
Fields inherited from interface org.xmldb.api.modules.XMLResource |
---|
RESOURCE_TYPE |
Constructor Summary | |
---|---|
SimpleXMLResource(Collection parent,
java.lang.String id,
java.lang.String documentID)
Create a new XMLResource without any content. |
|
SimpleXMLResource(Collection parent,
java.lang.String id,
java.lang.String documentID,
java.lang.String content)
Create a fully initialized XMLResource |
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 ID for the parent document of this resource. |
java.lang.String |
getResourceType()
Returns the resource type for this Resource. |
boolean |
getSAXFeature(java.lang.String feature)
Returns current setting of a SAX feature that will be used when this XMLResource is used to produce SAX events (through the
getContentAsSAX() method) |
void |
setContent(java.lang.Object value)
Sets the content for this resource. |
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 . |
void |
setSAXFeature(java.lang.String feature,
boolean value)
Sets a SAX feature that will be used when this XMLResource
is used to produce SAX events (through the getContentAsSAX() method) |
Methods inherited from class org.xmldb.api.sdk.modules.BaseResource |
---|
getId, getParentCollection |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xmldb.api.base.Resource |
---|
getId, getParentCollection |
Constructor Detail |
---|
public SimpleXMLResource(Collection parent, java.lang.String id, java.lang.String documentID)
public SimpleXMLResource(Collection parent, java.lang.String id, java.lang.String documentID, java.lang.String content)
Method Detail |
---|
public java.lang.String getDocumentId() throws XMLDBException
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 java.lang.String getResourceType() throws XMLDBException
getResourceType
in interface Resource
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public java.lang.Object getContent() throws XMLDBException
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
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 org.w3c.dom.Node getContentAsDOM() throws XMLDBException
Resource
as a DOM Node.
getContentAsDOM
in interface XMLResource
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.
setContentAsDOM
in interface XMLResource
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.
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() throws XMLDBException
Resource
using a SAX
ContentHandler
.
setContentAsSAX
in interface XMLResource
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.public void setSAXFeature(java.lang.String feature, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
XMLResource
is used to produce SAX events (through the getContentAsSAX() method)
setSAXFeature
in interface XMLResource
feature
- Feature name. Standard SAX feature names are documented at
http://sax.sourceforge.net/.value
- Set or unset feature
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public boolean getSAXFeature(java.lang.String feature) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
XMLResource
is used to produce SAX events (through the
getContentAsSAX() method)
getSAXFeature
in interface XMLResource
feature
- Feature name. Standard SAX feature names are documented at
http://sax.sourceforge.net/.
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
|
XML:DB API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |