The Source
and Result
interfaces abstract
out the API dependent details of exactly how an XML document
is represented. You can construct sources from DOM
nodes, SAX event sequences, and raw streams.
You can target the result of a transform at
a DOM Node
,
a SAX ContentHandler
,
or a stream-based target such as an
OutputStream
,
Writer
,
File
, or String
.
Other models may also provide their own implementations of
these interfaces. For instance, JDOM has an
org.jdom.transform
package that includes a
JDOMSource
and
JDOMResult
class.
In fact, these different models have very little in common, other than that
they all hold an XML document.
Consequently, the Source
and Result
interfaces don’t
themselves provide a lot of the functionality you need, just
methods to get the system and public ID of the document.
Everything else is deferred to the implementations.