org.xquark.xml.xdbc
Interface XMLDocument


public interface XMLDocument

This interface describes a document object which provides access to XML data in several ways. When the underlying object is a stored document, it also supports a number of document management methods also available in the XMLCollection interface.


Method Summary
 org.w3c.dom.Document getAsDocument()
          Returns the document content as a DOM2 Document.
 org.w3c.dom.Document getAsDOM()
          Deprecated. New method name is getAsDocument()
 void getAsDOM(org.w3c.dom.Element parent)
          Attaches a DOM2 fragment corresponding to the XML document to the Element node passed as a parameter.
 void getAsSAX()
          Returns the document content as a SAX2 event flow.
 void getAsStream(java.io.Writer out)
          Returns the document content in a provided character stream.
 java.lang.String getAsString()
          Returns the document content as an XML string.
 XMLCollection getCollection()
          Returns the XML collection to which this document belongs.
 org.xml.sax.ContentHandler getContentHandler()
          Retrieves the current (SAX2) content handler.
 org.xml.sax.ErrorHandler getErrorHandler()
          SRetrieves the current (SAX2) error handler.
 java.lang.String getIdentifier()
          Returns the document identifier in the XML collection.
 org.xml.sax.ext.LexicalHandler getLexicalHandler()
          Retrieves the current (SAX2) lexical handler.
 void remove()
          Removes the document from the collection to which it belongs.
 void setContentHandler(org.xml.sax.ContentHandler handler)
          Sets a (SAX2) content handler to intercept events produced when retrieving the document content.
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
          Sets a (SAX2) error handler to intercept error events produced when retrieving the document content.
 void setIdentifier(java.lang.String identifier)
          Changes the document identifier in the XML collection.
 void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
          Sets a (SAX2) lexical handler to intercept events produced when retrieving the document content.
 

Method Detail

getIdentifier

public java.lang.String getIdentifier()
Returns the document identifier in the XML collection. return the document identifier as a String, or null if the document is not a stored object.


setIdentifier

public void setIdentifier(java.lang.String identifier)
                   throws XMLDBCException,
                          XMLDBCNotSupportedException
Changes the document identifier in the XML collection. This change is persistent in the data source. Note: Depending on the auto-commit mode of the underlying data source connection, the change may only become definitive after a commit operation.

Parameters:
identifier - the new document identifier
Throws:
XMLDBCException - if a data source access error occurs.
XMLDBCNotSupportedException - if the renaming operation is not supported.

getCollection

public XMLCollection getCollection()
Returns the XML collection to which this document belongs. This may be null if the document is not a stored object.

Returns:
an XMLCollection object, or null if the document is not a stored object.

remove

public void remove()
            throws XMLDBCException,
                   XMLDBCNotSupportedException
Removes the document from the collection to which it belongs. The object should not be accessed any more after this method is called. Note: Depending on the auto-commit mode of the underlying data source connection, the change may only become definitive after a commit operation.

Throws:
XMLDBCException - if a data source access error occurs.
XMLDBCNotSupportedException - if the remove operation is not supported.

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)
Sets a (SAX2) content handler to intercept events produced when retrieving the document content.

*** ONLY FOR SAX2 ***

Parameters:
handler - the content handler implementation (see org.xml.sax.ContentHandler)

setLexicalHandler

public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Sets a (SAX2) lexical handler to intercept events produced when retrieving the document content.

*** ONLY FOR SAX2 ***

Parameters:
handler - the lexical handler implementation (see org.xml.sax.ext.LexicalHandler)

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)
Sets a (SAX2) error handler to intercept error events produced when retrieving the document content.

*** ONLY FOR SAX2 ***

Parameters:
handler - the error handler implementation (see org.xml.sax.ErrorHandler)

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Retrieves the current (SAX2) content handler.

*** ONLY FOR SAX2 ***

Returns:
the content handler implementation (see org.xml.sax.ContentHandler)

getLexicalHandler

public org.xml.sax.ext.LexicalHandler getLexicalHandler()
Retrieves the current (SAX2) lexical handler.

*** ONLY FOR SAX2 ***

Returns:
the lexical handler implementation (see org.xml.sax.ext.LexicalHandler)

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
SRetrieves the current (SAX2) error handler.

*** ONLY FOR SAX2 ***

Returns:
the error handler implementation (see org.xml.sax.ErrorHandler)

getAsDocument

public org.w3c.dom.Document getAsDocument()
                                   throws XMLDBCException
Returns the document content as a DOM2 Document.

Returns:
the DOM2 Document containing the document data.
Throws:
XMLDBCException - if a data source access error occurs.

getAsDOM

public org.w3c.dom.Document getAsDOM()
                              throws XMLDBCException
Deprecated. New method name is getAsDocument()

Returns the document content as a DOM2 Document.

Returns:
the DOM2 Document containing the document data.
Throws:
XMLDBCException - if a data source access error occurs.

getAsDOM

public void getAsDOM(org.w3c.dom.Element parent)
              throws XMLDBCException
Attaches a DOM2 fragment corresponding to the XML document to the Element node passed as a parameter.

Throws:
XMLDBCException - if a data source access error occurs.

getAsString

public java.lang.String getAsString()
                             throws XMLDBCException
Returns the document content as an XML string.

Returns:
the XML string containing the document data.
Throws:
XMLDBCException - if a data source access error occurs.

getAsStream

public void getAsStream(java.io.Writer out)
                 throws XMLDBCException
Returns the document content in a provided character stream.

Parameters:
out - a Writer object assuming user is responsible for the character encoding.
Throws:
XMLDBCException - if a data source access error occurs.

getAsSAX

public void getAsSAX()
              throws XMLDBCException,
                     org.xml.sax.SAXException
Returns the document content as a SAX2 event flow. This method uses the various SAX2 handlers set by the setXXXHandler() methods.

*** ONLY FOR SAX2 ***

Throws:
XMLDBCException - if a data source access error occurs or if the user has not set a content handler.
org.xml.sax.SAXException - if a handler exception occurs.


Copyright © 2004 Université de Versailles Saint-Quentin, XQuark Group. All rights reserved.