A number of operations can be performed on XML documents.
- A document can be created and stored in memory. This document can then be stored in the database, or written to a stream, or both.
- A document can be created and written to a stream directly to reduce storage requirements. This is particularly useful for very large documents that do not require an archived copy.
- A previously archived document can be retrieved from the database and written to a stream.
As streams are flexible, there are many things you can do with them.
- You can use a stream to save the XML data to a file.
- You can use the XMLPrintStream class to request that a document should be printed.
- You can use a stream to transfer information over a network via a socket connection.
- You can use a java.io.BufferedOutputStream to buffer all the XML data.
- You can create your own stream classes (or use any of the standard stream classes) to do just about anything you want with the XML data!