|  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 | | |  |  |  | This document describes the transformation API for XML (TrAX), the set of APIs contained in
	 javax.xml.transform, javax.xml.transform.stream, javax.xml.transform.dom, and javax.xml.transform.sax. There is a broad need for Java applications to be able to transform XML
	 and related tree-shaped data structures. In fact, XML is not normally very
	 useful to an application without going through some sort of transformation,
	 unless the semantic structure is used directly as data. Almost all XML-related
	 applications need to perform transformations. Transformations may be described
	 by Java code, Perl code, XSLT
	 Stylesheets, other types of script, or by proprietary formats. The inputs, one
	 or multiple, to a transformation, may be a URL, XML stream, a DOM tree, SAX
	 Events, or a proprietary format or data structure. The output types are 
	 pretty much the same types as the inputs, but different inputs may need to be
	 combined with different outputs. The great challenge of a transformation API is how to deal with all the
	 possible combinations of inputs and outputs, without becoming specialized for
	 any of the given types. | 
 
 |  |  |  | This section will explain some general terminology used in this
		document. Technical terminology will be explained in the Model section. In many
		cases, the general terminology overlaps with the technical terminology. 
TreeThis term, as used within this document, describes an
			 abstract structure that consists of nodes or events that may be produced by
			 XML. A Tree physically may be a DOM tree, a series of well balanced parse
			 events (such as those coming from a SAX2 ContentHander), a series of requests
			 (the result of which can describe a tree), or a stream of marked-up
			 characters.Source Tree(s)One or more trees that are the inputs to the
			 transformation.Result Tree(s)One or more trees that are the output of the
			 transformation.TransformationThe process of consuming a stream or tree to produce
			 another stream or tree.Identity (or Copy) TransformationThe process of transformation from a source to a result,
			 making as few structural changes as possible and no informational changes. The
			 term is somewhat loosely used, as the process is really a copy from one
			 "format" (such as a DOM tree, stream, or set of SAX events) to
			 another.SerializationThe process of taking a tree and turning it into a stream. In
			 some sense, a serialization is a specialized transformation.ParsingThe process of taking a stream and turning it into a tree. In
			 some sense, parsing is a specialized transformation.TransformerA Transformer is the object that executes the transformation.
			 Transformation instructionsDescribes the transformation. A form of code, script, or
			 simply a declaration or series of declarations.StylesheetThe same as "transformation instructions," except it is
			 likely to be used in conjunction with XSLT.TemplatesAnother form of "transformation instructions." In the TrAX
			 interface, this term is used to describe processed or compiled transformation
			 instructions. The Source flows through a Templates object to be formed into the
			 Result.ProcessorA general term for the thing that may both process the
			 transformation instructions, and perform the transformation.DOMDocument Object Model, specifically referring to the DOM level 3
                         Specification.SAXSimple API for XML, specifically referring to the
			 SAX 2.0
			 release. | 
 
 |  |  |  | The section defines the abstract model for TrAX, apart from the details
	 of the interfaces. A TrAX TransformerFactory is an object
	 that processes transformation instructions, and produces
	 Templates (in the technical
	 terminology). A Templates
	 object provides a Transformer, which transforms one or
	 more Sources into one or more
	 Results. To use the TrAX interface, you create a
	 TransformerFactory,
	 which may directly provide a Transformer, or which can provide
	 Templates from a variety of
	 Sources. The
	 Templates object is a processed
	 or compiled representation of the transformation instructions, and provides a
	 Transformer. The
	 Transformer processes a
	 Source according to the
	 instructions found in the Templates, and produces a
	 Result. The process of transformation from a tree, either in the form of an
	 object model, or in the form of parse events, into a stream, is known as
	 serialization. | 
 
 |  |  |  | The intent, responsibilities, and thread safety of TrAX objects: |  |  |  | 
IntentGeneric concept for the
  set of objects that implement the TrAX interfaces.ResponsibilitiesCreate compiled transformation instructions, transform
  sources, and manage transformation parameters and
  properties.Thread safetyOnly the Templates object can be
  used concurrently in multiple threads. The rest of the processor does not do
  synchronized blocking, and so may not be used to perform multiple concurrent
  operations. | 
 
 |  |  |  | 
IntentServe as a vendor-neutral Processor interface for
  XSLT and similar
  processors.ResponsibilitiesServe as a factory for a concrete
  implementation of an TransformerFactory, serve as a direct factory for
  Transformer objects, serve as a factory for Templates objects, and manage
  processor specific features.Thread safetyA TransformerFactory may not perform mulitple concurrent
  operations. | 
 
 |  |  |  | 
IntentThe runtime representation of the transformation instructions.ResponsibilitiesA data bag for transformation instructions; act as a factory
  for Transformers.Thread safetyThreadsafe for concurrent
  usage over multiple threads once construction is complete. | 
 
 |  |  |  | 
IntentAct as a per-thread
  execution context for transformations, act as an interface for performing the
  transformation.ResponsibilitiesPerform the
  transformation.Thread safetyOnly one instance per thread
  is safe. |  | The Transformer is bound to the Templates
  object that created it. | 
 | 
 
 |  |  |  | 
IntentServe as a
  single vendor-neutral object for multiple types of input.ResponsibilitiesAct as simple data holder for System IDs, DOM nodes, streams,
  etc.Thread safetyThreadsafe concurrently over multiple
  threads for read-only operations; must be synchronized for edit
  operations. | 
 
 |  |  |  | 
IntentServe
  as a single object for multiple types of output, so there can be simple process
  method signatures.ResponsibilitiesAct as simple data holder for
  output stream, DOM node, ContentHandler, etc.Thread safetyThreadsafe concurrently over multiple threads for read-only,
  must be synchronized for edit. | 
 
 | 
 
 | 
 |