org.exist.fluent
Class XMLDocument

java.lang.Object
  extended by org.exist.fluent.Resource
      extended by org.exist.fluent.NamedResource
          extended by org.exist.fluent.Document
              extended by org.exist.fluent.XMLDocument

public class XMLDocument
extends Document

An XML document from the database.

Author:
Piotr Kaminski

Nested Class Summary
 
Nested classes/interfaces inherited from class org.exist.fluent.Document
Document.Event, Document.Listener, Document.ListenersFacet, Document.MetadataFacet
 
Method Summary
 String contentsAsString()
          Return the serialized contents of this XML document.
 XMLDocument copy(Folder destination, Name name)
          Copy this document to another collection, potentially changing the copy's name in the process.
 QueryService query()
          Return a query service that executes queries in the context of this document.
 Node root()
          Return the root element node of this document.
 String toString()
          Return a string representation of the reference to this document.
 void write(OutputStream stream)
          Serialize this document to the given output stream using the default encoding specified for the database.
 void write(Writer writer)
          Serialize this document to the given writer.
 XMLDocument xml()
          Return this XML document.
 
Methods inherited from class org.exist.fluent.Document
delete, equals, export, folder, hashCode, length, listeners, metadata, move, name, path
 
Methods inherited from class org.exist.fluent.Resource
database, namespaceBindings
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

xml

public XMLDocument xml()
Return this XML document.

Overrides:
xml in class Document
Returns:
this document

root

public Node root()
Return the root element node of this document.

Returns:
the root element node of this document

query

public QueryService query()
Return a query service that executes queries in the context of this document.

Overrides:
query in class Resource
Returns:
a query service over this document

toString

public String toString()
Return a string representation of the reference to this document. The representation will list the document's path, but will not include its contents.

Overrides:
toString in class Document
Returns:
a string representation of this XML document

copy

public XMLDocument copy(Folder destination,
                        Name name)
Description copied from class: Document
Copy this document to another collection, potentially changing the copy's name in the process.

Overrides:
copy in class Document
Parameters:
destination - the destination folder for the copy
name - the desired name for the copy
Returns:
the new copy of the document
See Also:
Name

contentsAsString

public String contentsAsString()
Return the serialized contents of this XML document.

Overrides:
contentsAsString in class Document
Returns:
the serialized contents of this XML document
See Also:
Database.setDefaultCharacterEncoding(String)

write

public void write(OutputStream stream)
           throws IOException
Serialize this document to the given output stream using the default encoding specified for the database. If you wish to control the encoding at a finer granularity, use write(Writer).

Overrides:
write in class Document
Parameters:
stream - the output stream to write to
Throws:
IOException - in case of problems with the encoding
DatabaseException - in case of I/O problems
See Also:
Database.setDefaultCharacterEncoding(String)

write

public void write(Writer writer)
Serialize this document to the given writer.

Parameters:
writer - destination writer


Copyright (C) All rights reserved.