0N/A<?
xml version="1.0" encoding="UTF-8"?>
0N/ACopyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 0N/ADO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/AThis code is free software; you can redistribute it and/or modify it 2362N/Aunder the terms of the GNU General Public License version 2 only, as 0N/Apublished by the Free Software Foundation. Oracle designates this 2362N/Aparticular file as subject to the "Classpath" exception as provided 0N/Aby Oracle in the LICENSE file that accompanied this code. 0N/AThis code is distributed in the hope that it will be useful, but WITHOUT 0N/AANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/AFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/Aversion 2 for more details (a copy is included in the LICENSE file that 0N/Aaccompanied this code). 0N/AYou should have received a copy of the GNU General Public License version 0N/A2 along with this work; if not, write to the Free Software Foundation, 0N/AInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/APlease contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 0N/A content="Jeff.Suttor@Sun.com" />
0N/A<
p>This package defines the generic APIs for processing transformation
0N/Ainstructions, and performing a transformation from source to result. These
0N/Ainterfaces have no dependencies on SAX or the DOM standard, and try to make as
0N/Afew assumptions as possible about the details of the source and result of a
0N/Atransformation. It achieves this by defining
0N/A<
p>To define concrete classes for the user, the API defines specializations
0N/Aof the interfaces found at the root level. These interfaces are found in
0N/A<
h3>Creating Objects</
h3>
0N/A<
p>The API allows a concrete
0N/A<
h3>Specification of Inputs and Outputs</
h3>
0N/A<
p>This API defines two interface objects called
0N/Aobjects to the interfaces, concrete classes must be used.
Three concrete representations are defined for each of these
a FEATURE string (which is i the form of a URL), which can be passed into
given type of Source or Result object is supported. For instance, to test if a
DOMSource and a StreamResult is supported, you can apply the following
<
a name="qname-delimiter">Qualified Name Representation</
a>
present something of a problem area when dealing with XML objects. Qualified
Names appear in XML markup as prefixed names. But the prefixes themselves do
not hold identity. Rather, it is the URIs that they contextually map to that
hold the identity. Therefore, when passing a Qualified Name like "xyz:foo"
among Java programs, one must provide a means to map "xyz" to a namespace.
<
p>One solution has been to create a "QName" object that holds the
namespace URI, as well as the prefix and local name, but this is not always an
optimal solution, as when, for example, you want to use unique strings as keys
in a dictionary object. Not having a string representation also makes it
difficult to specify a namespaced identity outside the context of an XML
<
p>In order to pass namespaced values to transformations,
instance when setting a property or a parameter on a
this specification defines that a
String "qname" object parameter be passed as two-part string, the namespace URI
enclosed in curly braces ({}), followed by the local name. If the qname has a
null URI, then the String object only contains the local name. An application
can safely check for a non-null URI by testing to see if the first character of
the name is a '{' character.
<
p>For example, if a URI and local name were obtained from an element
Note that the prefix is lost.
<
h3>Result Tree Serialization</
h3>
<
p>Serialization of the result tree to a stream can be controlled with
These properties only apply to stream results, they have no effect when
the result is a DOM tree or SAX event stream.</
p>
specification for xsl:output attributes</
a> can be referenced from the
If the transformer does not recognize an output key, a
key name is <
a href="#qname-delimiter">namespace qualified</
a>. Output key names
that are namespace qualified are always allowed, although they may be
ignored by some implementations.</
p>
<
p>If all that is desired is the simple identity transformation of a
with no arguments. This method creates a Transformer that effectively copies
the source to the result. This method may be used to create a DOM from SAX
events or to create an XML or HTML stream from a DOM or SAX events. </
p>
<
h3>Exceptions and Error Reporting</
h3>
<
p>The transformation API throw three types of specialized exceptions. A
when a configuration problem with the TransformerFactory exists. This error
will typically be thrown when the transformation factory class specified with
may be thrown if for any reason a Transformer can not be created. A
TransformerConfigurationException may be thrown if there is a syntax error in
the transformation instructions, for example when
exception that occurs during the course of a transformation. A transformer
exception may wrap another exception, and if any of the
methods are called on it, it will produce a list of stack dumps, starting from
the most recent. The transformer exception also provides a
in the source tree or transformation instructions the error occurred.
may be called to get an error message with location info, and
may be called to get just the location string.</
p>
<
p>Transformation warnings and errors are sent to an
application may decide to report the error or warning, and may decide to throw
an <
code>Exception</
code> for a non-fatal error. The <
code>ErrorListener</
code> may be set via
reporting errors that have to do with syntax errors in the transformation
errors that occur during the transformation. The <
code>ErrorListener</
code> on both objects
will always be valid and non-<
code>null</
code>, whether set by the application or a default
implementation provided by the processor.
The default implementation provided by the processor will report all warnings and errors to <
code>
System.err</
code>
and does not throw any <
code>Exception</
code>s.
Applications are <
em>strongly</
em> encouraged to register and use
<
code>ErrorListener</
code>s that insure proper behavior for warnings and
<
h3>Resolution of URIs within a transformation</
h3>
<
p>The API provides a way for URIs referenced from within the stylesheet
instructions or within the transformation to be resolved by the calling
application. This can be done by creating a class that implements the
set the URI resolution for the transformation instructions or transformation
stylesheet instructions or built as part of the transformation process, and the
against which the first argument will be made absolute if the
absolute URI is required.
the transformer, as specified in its implemented features.</
p>