| java.lang.Object org.ozoneDB.xml.util.XMLContainer
XMLContainer | public class XMLContainer implements Externalizable,SAXChunkProducerDelegate(Code) | | This class is the central part of the ozone/XML API. Basically it provides a
persistent container for a XML document, which is stored in an ozone database.
- IMPORTANT:
- Before calling one of the store or extract methods the
thread must have joined a transaction.
Usage of the SAX methods is recomended, because of the better performance.
version: $Revision: 1.1 $ $Date: 2001/12/18 11:03:24 $ author: SMB |
Field Summary | |
final public static boolean | debug |
Method Summary | |
public synchronized void | delete() Deletes the container (and the associated document) from the database. | protected XObject | executeXPath(OzoneXPathQuery _query) | protected void | executeXUpdate(OzoneXUpdateQuery _query) | public Document | extractDOM(Document _domFactory) | public Node | extractDOM(Document _domFactory, Node _pNode, Node _appendTo) | public Node | extractDOM(Document _domFactory, Node _pNode, Node _appendTo, int _depth) Extracts a given DOM node and all its descendants.
Before calling this method the current thread must have joined an
org.ozoneDB.ExternalTransaction explicit Transaction . | public NodeList | extractDOM(Document _domFactory, NodeList _pNodes, Node _appendTo, int _depth) | public void | extractSAX(ContentHandler _contentHandler) | public void | extractSAX(ContentHandler _contentHandler, Node _pNode) | public void | extractSAX(ContentHandler _contentHandler, Node _pNode, int _depth) Extracts a given DOM node and all its descendants.
Before calling this method the current thread must have joined an
org.ozoneDB.ExternalTransaction explicit Transaction . | public static XMLContainer | forName(OzoneInterface _db, String _docName) Returns the XMLContainer representing the document with the given name.
Parameters: _db - The database where the container is stored. Parameters: _docName - The name under which the container has been stored. | public static XMLContainer | forNode(OzoneInterface _db, Node _pNode) Returns the XMLContainer representing the document the given node
belongs to.
Parameters: _db - The database where the container is stored. Parameters: _pNode - A node of the document the container represents. | public Document | getPDocument() Get the underlying persistent document that this container is working on. | public static XMLContainer | newContainer(OzoneInterface _db, String _docName) Creates a new container with the given name.
Parameters: _db - The database where the container will be stored. Parameters: _docName - The name of the container (and the document). | public OzoneXPathQuery | newXPathQuery() Create a new XPath query. | public OzoneXUpdateQuery | newXUpdateQuery() Create a new XUpdate query. | public void | processChunk(SAXChunkProducer _producer) This method is for internal use only. | public void | readExternal(ObjectInput _in) | public void | setName(String _name) Changes the name of this container. | public void | storeDOM(Document _tNode) Stores a transient DOM tree database. | public void | storeDOM(Node _pNode, Node _tNode) Stores a transient node into the database.
Before calling this method the current thread must have joined an
org.ozoneDB.ExternalTransaction explicit Transaction . | public ContentHandler | storeSAX() Stores a DOM tree represented by SAX events in the datasabase. | public ContentHandler | storeSAX(Node _pNode) Stores XML represented by SAX events into the database.
The entire storage process must be enclosed by an
org.ozoneDB.ExternalTransaction explicit Transaction . | public void | writeExternal(ObjectOutput _out) | public String | xpathForNode(Node _pnode) Determines the absolute XPath for the given node.
Parameters: node - The W3C DOM node whose XPath is to determine. |
debug | final public static boolean debug(Code) | | |
delete | public synchronized void delete() throws Exception(Code) | | Deletes the container (and the associated document) from the database.
|
extractDOM | public Node extractDOM(Document _domFactory, Node _pNode, Node _appendTo, int _depth) throws Exception(Code) | | Extracts a given DOM node and all its descendants.
Before calling this method the current thread must have joined an
org.ozoneDB.ExternalTransaction explicit Transaction . This is an
exception to the normal case, where an implicit transaction (handled by
Ozone) is more appropriate.
- Note:
- If possible, the corresponding
XMLContainer.extractSAX(ContentHandler) SAX method should be used, because the
performance of SAX retrieval is much better.
Parameters: _domFactory - The DOM Document that is used to create the extracted DOM nodes. Parameters: _pNode - The persistent DOM node Parameters: _appendTo - The transient DOM node where the extracted content willwill be appended to. Parameters: _depth - The number of hierarchy steps that should be extracted ornull if the entire hierarchy should be extracted. |
extractSAX | public void extractSAX(ContentHandler _contentHandler, Node _pNode, int _depth) throws Exception(Code) | | Extracts a given DOM node and all its descendants.
Before calling this method the current thread must have joined an
org.ozoneDB.ExternalTransaction explicit Transaction . This is an
exception to the normal case, where an implicit transaction (handled by
Ozone) is more appropriate.
Parameters: _contentHandler - The ContentHandler that will receive the generatedSAX events. Parameters: _pNode - The persistent DOM node that is the starting point, or nullif the entire document should be extracted. Parameters: _depth - The number of hierarchy steps that should be extracted ornull if the entire hierarchy should be extracted. |
forName | public static XMLContainer forName(OzoneInterface _db, String _docName) throws Exception(Code) | | Returns the XMLContainer representing the document with the given name.
Parameters: _db - The database where the container is stored. Parameters: _docName - The name under which the container has been stored. the container for the given name or null if the containerdoes not exist. |
forNode | public static XMLContainer forNode(OzoneInterface _db, Node _pNode) throws Exception(Code) | | Returns the XMLContainer representing the document the given node
belongs to.
Parameters: _db - The database where the container is stored. Parameters: _pNode - A node of the document the container represents. the container for the given node or null if the node has notbeen stored using the XMLContainer class. |
getPDocument | public Document getPDocument() throws Exception(Code) | | Get the underlying persistent document that this container is working on.
The persistent document. |
newContainer | public static XMLContainer newContainer(OzoneInterface _db, String _docName) throws Exception(Code) | | Creates a new container with the given name.
Parameters: _db - The database where the container will be stored. Parameters: _docName - The name of the container (and the document). the new container. |
newXUpdateQuery | public OzoneXUpdateQuery newXUpdateQuery()(Code) | | Create a new XUpdate query. XUpdate is a descriptive XML update
language. XUpdate is the recommended way to change a document in the
database. See www.xmldb.org for more
information and some XUpdate documentation.
See Also: OzoneXUpdateQuery |
setName | public void setName(String _name) throws Exception(Code) | | Changes the name of this container.
Parameters: _name - The new name of this container or null to remove thecurrent name. |
storeSAX | public ContentHandler storeSAX(Node _pNode) throws Exception(Code) | | Stores XML represented by SAX events into the database.
The entire storage process must be enclosed by an
org.ozoneDB.ExternalTransaction explicit Transaction . This is an
exception to the normal case, where an implicit transaction (handled by
Ozone) is more appropriate. The storage process starts with the call to this
method and ends with the last event send to the content handler. The SAX
events must be properly terminated, i.e. there must be an end event for
for every start event, otherwise the correct storage can't be guaranteed.
Parameters: _pNode - The persistent node where the stored data will be appended to. the content handler which stores all XML data it recieves into thedatabase. throws: IllegalStateException - if the underlying document has already been deleted. throws: IllegalStateException - if the current thread has not joined aorg.ozoneDB.ExternalTransaction transaction. See Also: org.ozoneDB.ExternalTransaction See Also: org.ozoneDB.ExternalDatabase.newTransaction |
xpathForNode | public String xpathForNode(Node _pnode)(Code) | | Determines the absolute XPath for the given node.
Parameters: node - The W3C DOM node whose XPath is to determine. The string representing the absolute XPath for this node. |
|
|