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