summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/xml/transform
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/xml/transform')
-rw-r--r--libjava/classpath/javax/xml/transform/ErrorListener.java66
-rw-r--r--libjava/classpath/javax/xml/transform/OutputKeys.java103
-rw-r--r--libjava/classpath/javax/xml/transform/Result.java72
-rw-r--r--libjava/classpath/javax/xml/transform/Source.java60
-rw-r--r--libjava/classpath/javax/xml/transform/SourceLocator.java70
-rw-r--r--libjava/classpath/javax/xml/transform/Templates.java67
-rw-r--r--libjava/classpath/javax/xml/transform/Transformer.java164
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerConfigurationException.java101
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerException.java246
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerFactory.java284
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java106
-rw-r--r--libjava/classpath/javax/xml/transform/URIResolver.java58
-rw-r--r--libjava/classpath/javax/xml/transform/dom/DOMLocator.java57
-rw-r--r--libjava/classpath/javax/xml/transform/dom/DOMResult.java163
-rw-r--r--libjava/classpath/javax/xml/transform/dom/DOMSource.java118
-rw-r--r--libjava/classpath/javax/xml/transform/dom/package.html5
-rw-r--r--libjava/classpath/javax/xml/transform/package.html38
-rw-r--r--libjava/classpath/javax/xml/transform/sax/SAXResult.java132
-rw-r--r--libjava/classpath/javax/xml/transform/sax/SAXSource.java197
-rw-r--r--libjava/classpath/javax/xml/transform/sax/SAXTransformerFactory.java115
-rw-r--r--libjava/classpath/javax/xml/transform/sax/TemplatesHandler.java68
-rw-r--r--libjava/classpath/javax/xml/transform/sax/TransformerHandler.java78
-rw-r--r--libjava/classpath/javax/xml/transform/sax/package.html9
-rw-r--r--libjava/classpath/javax/xml/transform/stream/StreamResult.java173
-rw-r--r--libjava/classpath/javax/xml/transform/stream/StreamSource.java210
-rw-r--r--libjava/classpath/javax/xml/transform/stream/package.html6
26 files changed, 2766 insertions, 0 deletions
diff --git a/libjava/classpath/javax/xml/transform/ErrorListener.java b/libjava/classpath/javax/xml/transform/ErrorListener.java
new file mode 100644
index 000000000..ac236642a
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/ErrorListener.java
@@ -0,0 +1,66 @@
+/* ErrorListener.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package javax.xml.transform;
+
+/**
+ * Error reporting callback handler.
+ * Equivalent to the SAX ErrorHandler.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface ErrorListener
+{
+
+ /**
+ * Reports a warning condition.
+ */
+ public void warning(TransformerException exception)
+ throws TransformerException;
+
+ /**
+ * Reports a recoverable error.
+ */
+ public void error(TransformerException exception)
+ throws TransformerException;
+
+ /**
+ * Reports a fatal error.
+ */
+ public void fatalError(TransformerException exception)
+ throws TransformerException;
+
+}
diff --git a/libjava/classpath/javax/xml/transform/OutputKeys.java b/libjava/classpath/javax/xml/transform/OutputKeys.java
new file mode 100644
index 000000000..09cf96cb9
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/OutputKeys.java
@@ -0,0 +1,103 @@
+/* OutputKeys.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform;
+
+/**
+ * Constants for XSLT output attributes.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class OutputKeys
+{
+
+ /**
+ * The output method (xml, html, or text).
+ */
+ public static final String METHOD = "method";
+
+ /**
+ * The version of the output method.
+ */
+ public static final String VERSION = "version";
+
+ /**
+ * The preferred output character encoding.
+ */
+ public static final String ENCODING = "encoding";
+
+ /**
+ * Whether not to output an XML declaration (yes or no).
+ */
+ public static final String OMIT_XML_DECLARATION = "omit-xml-declaration";
+
+ /**
+ * Whether to output a standalone document declaration (yes or no).
+ */
+ public static final String STANDALONE = "standalone";
+
+ /**
+ * The public ID to output in the doctype declaration.
+ */
+ public static final String DOCTYPE_PUBLIC = "doctype-public";
+
+ /**
+ * The system ID to output in the doctype declaration.
+ */
+ public static final String DOCTYPE_SYSTEM = "doctype-system";
+
+ /**
+ * Whitespace-separated list of element names for which text children
+ * should be output as CDATA sections.
+ */
+ public static final String CDATA_SECTION_ELEMENTS = "cdata-section-elements";
+
+ /**
+ * Whether to indent the result tree (yes or no).
+ */
+ public static final String INDENT = "indent";
+
+ /**
+ * The MIME content type of the output data.
+ */
+ public static final String MEDIA_TYPE = "media-type";
+
+ private OutputKeys()
+ {
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/Result.java b/libjava/classpath/javax/xml/transform/Result.java
new file mode 100644
index 000000000..8f4d6c714
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/Result.java
@@ -0,0 +1,72 @@
+/* Result.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package javax.xml.transform;
+
+/**
+ * The result of an XSL transformation.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface Result
+{
+
+ /**
+ * Constant for the processing instruction sent when the result disables
+ * output escaping.
+ */
+ public static final String PI_DISABLE_OUTPUT_ESCAPING =
+ "javax.xml.transform.disable-output-escaping";
+
+ /**
+ * Constant for the processing instruction sent when the result enables
+ * output escaping.
+ */
+ public static final String PI_ENABLE_OUTPUT_ESCAPING =
+ "javax.xml.transform.enable-output-escaping";
+
+ /**
+ * Sets the XML system ID for this result.
+ * @param systemId the system ID URI
+ */
+ public void setSystemId(String systemId);
+
+ /**
+ * Returns the system ID for this result.
+ */
+ public String getSystemId();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/Source.java b/libjava/classpath/javax/xml/transform/Source.java
new file mode 100644
index 000000000..f109dcc35
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/Source.java
@@ -0,0 +1,60 @@
+/* Source.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package javax.xml.transform;
+
+/**
+ * An XML input source.
+ * This is equivalent to a SAX InputSource.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface Source
+{
+
+ /**
+ * Sets the XML system ID for this source.
+ * This can be used to resolve external entities in the source.
+ * @param systemId the system ID URI
+ */
+ public void setSystemId(String systemId);
+
+ /**
+ * Returns the system ID for this source.
+ */
+ public String getSystemId();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/SourceLocator.java b/libjava/classpath/javax/xml/transform/SourceLocator.java
new file mode 100644
index 000000000..190a3b165
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/SourceLocator.java
@@ -0,0 +1,70 @@
+/* SourceLocator.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package javax.xml.transform;
+
+/**
+ * The location in an XML resource at which an event occurred.
+ * Tis is equivalent to the SAX Locator.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface SourceLocator
+{
+
+ /**
+ * Returns the XML public ID for the document.
+ */
+ public String getPublicId();
+
+ /**
+ * Returns the XML system ID for the document.
+ */
+ public String getSystemId();
+
+ /**
+ * Returns the line number at which the event occurred.
+ * @return the line number, or -1 if not available
+ */
+ public int getLineNumber();
+
+ /**
+ * Returns the column number at which the event occurred.
+ * @return the column number, or -1 if not available
+ */
+ public int getColumnNumber();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/Templates.java b/libjava/classpath/javax/xml/transform/Templates.java
new file mode 100644
index 000000000..34d953327
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/Templates.java
@@ -0,0 +1,67 @@
+/* Templates.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform;
+
+import java.util.Properties;
+
+/**
+ * A compiled, reusable XSL transformation.
+ * Implementations of this class are guaranteed to be thread safe.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface Templates
+{
+
+ /**
+ * Creates a new transformer based on this transformation.
+ */
+ public Transformer newTransformer()
+ throws TransformerConfigurationException;
+
+ /**
+ * Returns the static properties for the <code>xsl:output</code>
+ * instruction. Missing properties are defaulted according the
+ * <a href='http://www.w3.org/TR/xslt#output'>XSLT Recommendation, section
+ * 16</a>: <code>getProperty(String)</code> returns all properties
+ * including defaulted ones, and <code>get(Object)</code> returns only the
+ * properties explicitly set in the stylesheet.
+ */
+ public Properties getOutputProperties();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/Transformer.java b/libjava/classpath/javax/xml/transform/Transformer.java
new file mode 100644
index 000000000..316675b41
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/Transformer.java
@@ -0,0 +1,164 @@
+/* Transformer.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform;
+
+import java.util.Properties;
+
+/**
+ * An XSL transformation.
+ * Instances of this class may be reused, but the same instance may not be
+ * used concurrently by different threads.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public abstract class Transformer
+{
+
+ protected Transformer()
+ {
+ }
+
+ /**
+ * Transforms the source XML to a result tree.
+ * @param xmlSource the XML source
+ * @param outputTarget the result of the transformation
+ */
+ public abstract void transform(Source xmlSource, Result outputTarget)
+ throws TransformerException;
+
+ /**
+ * Sets a parameter value for the transformation.
+ * Parameters may be referenced in the XSLT stylesheet.
+ * @param name the parameter name (an XML Name, or a namespace-prefixed
+ * XML Name of the form <code>{<i>namespaceURI</i>}<i>localName</i></code>
+ * @param value the value to assign
+ */
+ public abstract void setParameter(String name, Object value);
+
+ /**
+ * Returns the specified parameter value.
+ * @param name the parameter name (an XML Name, or a namespace-prefixed
+ * XML Name of the form <code>{<i>namespaceURI</i>}<i>localName</i></code>
+ */
+ public abstract Object getParameter(String name);
+
+ /**
+ * Clears all parameter values.
+ */
+ public abstract void clearParameters();
+
+ /**
+ * Sets the callback used to resolve entities referenced by
+ * <code>xsl:include</code>, <code>xsl:import</code>, or the XPath
+ * <code>document()</code> function.
+ */
+ public abstract void setURIResolver(URIResolver resolver);
+
+ /**
+ * Returns the callback used to resolve entities referenced by
+ * <code>xsl:include</code>, <code>xsl:import</code>, or the XPath
+ * <code>document()</code> function.
+ */
+ public abstract URIResolver getURIResolver();
+
+ /**
+ * Sets the output properties for the transformation, overriding any
+ * properties defined in the stylesheet.
+ * The format of property keys is as in the
+ * {@link #setOutputProperty(java.lang.String,java.lang.String)} method.
+ * @param oformat a set of output properties, or null to reset all the
+ * properties to their default values
+ */
+ public abstract void setOutputProperties(Properties oformat)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns a copy of the output properties for the transformation.
+ * Missing properties are defaulted according the
+ * <a href='http://www.w3.org/TR/xslt#output'>XSLT Recommendation, section
+ * 16</a>: <code>getProperty(String)</code> returns all properties
+ * including defaulted ones, and <code>get(Object)</code> returns only the
+ * properties explicitly set in the stylesheet.
+ */
+ public abstract Properties getOutputProperties();
+
+ /**
+ * Sets an output property for the transformation, overriding any property
+ * of the same name defined in the stylesheet.
+ * @param name the property name (an XML Name, or a namespace-prefixed
+ * XML Name of the form <code>{<i>namespaceURI</i>}<i>localName</i></code>
+ * @param value the string value of the property
+ * @exception IllegalArgumentException if the property is not supported
+ */
+ public abstract void setOutputProperty(String name, String value)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns the value of an output property for the transformation.
+ * Only explicit properties set programmatically or defined in the
+ * stylesheet, not defaulted properties, are returned by this method.
+ * @param name the property name (an XML Name, or a namespace-prefixed
+ * XML Name of the form <code>{<i>namespaceURI</i>}<i>localName</i></code>
+ * @exception IllegalArgumentException if the property is not supported
+ */
+ public abstract String getOutputProperty(String name)
+ throws IllegalArgumentException;
+
+ /**
+ * Sets the callback used to report errors during the transformation.
+ * @exception IllegalArgumentException if the listener is null
+ */
+ public abstract void setErrorListener(ErrorListener listener)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns the callback used to report errors during the transformation.
+ */
+ public abstract ErrorListener getErrorListener();
+
+ // -- JAXP 1.3 methods --
+
+ /**
+ * Reset this Transformer to its original configuration.
+ * @since 1.3
+ */
+ public void reset()
+ {
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
new file mode 100644
index 000000000..3343a8041
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
@@ -0,0 +1,101 @@
+/* TransformerConfigurationException.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform;
+
+/**
+ * An exception occurred during configuration of the transformer.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class TransformerConfigurationException
+ extends TransformerException
+{
+ private static final long serialVersionUID = 1285547467942875745L;
+
+ /**
+ * Constructor with no detail message.
+ */
+ public TransformerConfigurationException()
+ {
+ this(null, null, null);
+ }
+
+ /**
+ * Constructor with a detail message.
+ */
+ public TransformerConfigurationException(String msg)
+ {
+ this(msg, null, null);
+ }
+
+ /**
+ * Constructor with underlying cause.
+ */
+ public TransformerConfigurationException(Throwable e)
+ {
+ this(e.getMessage(), null, e);
+ }
+
+ /**
+ * Constructor with detail message and underlyinmg cause.
+ */
+ public TransformerConfigurationException(String msg, Throwable e)
+ {
+ this(msg, null, e);
+ }
+
+ /**
+ * Constructor with detail message and locator.
+ */
+ public TransformerConfigurationException(String message,
+ SourceLocator locator)
+ {
+ this(message, locator, null);
+ }
+
+ /**
+ * Constructor with detail message, locator and underlying cause.
+ */
+ public TransformerConfigurationException(String message,
+ SourceLocator locator,
+ Throwable e)
+ {
+ super(message, locator, e);
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/TransformerException.java b/libjava/classpath/javax/xml/transform/TransformerException.java
new file mode 100644
index 000000000..ac83e969c
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/TransformerException.java
@@ -0,0 +1,246 @@
+/* TransformerException.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform;
+
+import gnu.java.lang.CPStringBuilder;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * An exception occurred during the transformation process.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class TransformerException
+ extends Exception
+{
+ private static final long serialVersionUID = 975798773772956428L;
+
+ // Field names fixed by serialization spec.
+ private SourceLocator locator;
+ private Throwable containedException;
+
+ /**
+ * Constructor with a detail message.
+ */
+ public TransformerException(String msg)
+ {
+ this(msg, null, null);
+ }
+
+ /**
+ * Constructor with an underlying cause.
+ */
+ public TransformerException(Throwable cause)
+ {
+ this(cause.getMessage(), null, cause);
+ }
+
+ /**
+ * Constructor with a detail message and underlying cause.
+ */
+ public TransformerException(String msg, Throwable cause)
+ {
+ this(msg, null, cause);
+ }
+
+ /**
+ * Constructor with a detail message and locator.
+ */
+ public TransformerException(String msg, SourceLocator locator)
+ {
+ this(msg, locator, null);
+ }
+
+ /**
+ * Constructor with detail message, locator and underlying cause.
+ */
+ public TransformerException(String msg, SourceLocator locator,
+ Throwable cause)
+ {
+ super(msg);
+ this.locator = locator;
+ if (cause != null)
+ {
+ initCause(cause);
+ this.containedException = cause;
+ }
+ }
+
+ /**
+ * Returns a locator indicating where the error occurred.
+ */
+ public SourceLocator getLocator()
+ {
+ return locator;
+ }
+
+ /**
+ * Sets the locator indicating where the error occurred.
+ */
+ public void setLocator(SourceLocator location)
+ {
+ locator = location;
+ }
+
+ /**
+ * Returns the underlying cause of this exception.
+ */
+ public Throwable getException()
+ {
+ return containedException;
+ }
+
+ /**
+ * Returns the underlying cause of this exception.
+ */
+ public Throwable getCause()
+ {
+ return containedException;
+ }
+
+ /**
+ * Initializes the root cause of this exception.
+ * This method may be called only once, and will be called by the
+ * constructor if a non-null cause is specified.
+ * Really phenomenally poor API design.
+ * @param cause the underlying cause
+ * @exception IllegalArgumentException if this exception is passed as the
+ * argument
+ * @exception IllegalStateException if a cause has already been
+ * initialized
+ */
+ public Throwable initCause(Throwable cause)
+ {
+ if (this.containedException != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (cause == this)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.containedException = cause;
+ return this;
+ }
+
+ /**
+ * Returns the exception message with location information appended.
+ */
+ public String getMessageAndLocation()
+ {
+ return (locator == null) ? getMessage() :
+ getMessage() + ": " + getLocationAsString();
+ }
+
+ /**
+ * Returns the location information as a string.
+ */
+ public String getLocationAsString()
+ {
+ if (locator == null)
+ {
+ return null;
+ }
+ String publicId = locator.getPublicId();
+ String systemId = locator.getSystemId();
+ int lineNumber = locator.getLineNumber();
+ int columnNumber = locator.getColumnNumber();
+ CPStringBuilder buffer = new CPStringBuilder ();
+ if (publicId != null)
+ {
+ buffer.append ("publicId=");
+ buffer.append (publicId);
+ }
+ if (systemId != null)
+ {
+ if (buffer.length() > 0)
+ {
+ buffer.append(' ');
+ }
+ buffer.append ("systemId=");
+ buffer.append (systemId);
+ }
+ if (lineNumber != -1)
+ {
+ if (buffer.length() > 0)
+ {
+ buffer.append(' ');
+ }
+ buffer.append ("lineNumber=");
+ buffer.append (lineNumber);
+ }
+ if (columnNumber != -1)
+ {
+ if (buffer.length() > 0)
+ {
+ buffer.append(' ');
+ }
+ buffer.append ("columnNumber=");
+ buffer.append (columnNumber);
+ }
+ return buffer.toString();
+ }
+
+ public void printStackTrace()
+ {
+ printStackTrace(System.out);
+ }
+
+ public void printStackTrace(PrintStream s)
+ {
+ super.printStackTrace(s);
+ if (containedException != null)
+ {
+ s.print("caused by ");
+ containedException.printStackTrace(s);
+ }
+ }
+
+ public void printStackTrace(PrintWriter s)
+ {
+ super.printStackTrace(s);
+ if (containedException != null)
+ {
+ s.print("caused by ");
+ containedException.printStackTrace(s);
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/TransformerFactory.java b/libjava/classpath/javax/xml/transform/TransformerFactory.java
new file mode 100644
index 000000000..0bcc48627
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/TransformerFactory.java
@@ -0,0 +1,284 @@
+/* TransformerFactory.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Factory for obtaining transformation contexts.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public abstract class TransformerFactory
+{
+
+ protected TransformerFactory()
+ {
+ }
+
+ /**
+ * Creates a new factory instance.
+ * The implementation class to load is the first found in the following
+ * locations:
+ * <ol>
+ * <li>the <code>javax.xml.transform.TransformerFactory</code> system
+ * property</li>
+ * <li>the above named property value in the
+ * <code><i>$JAVA_HOME</i>/lib/jaxp.properties</code> file</li>
+ * <li>the class name specified in the
+ * <code>META-INF/services/javax.xml.parsers.DocumentBuilderFactory</code>
+ * system resource</li>
+ * <li>the default factory class</li>
+ * </ol>
+ */
+ public static TransformerFactory newInstance()
+ throws TransformerFactoryConfigurationError
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null)
+ {
+ loader = TransformerFactory.class.getClassLoader();
+ }
+ String className = null;
+ int count = 0;
+ do
+ {
+ className = getFactoryClassName(loader, count++);
+ if (className != null)
+ {
+ try
+ {
+ Class<?> t = (loader != null) ? loader.loadClass(className) :
+ Class.forName(className);
+ return (TransformerFactory) t.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ className = null;
+ }
+ catch (Exception e)
+ {
+ throw new TransformerFactoryConfigurationError(e,
+ "error instantiating class " + className);
+ }
+ }
+ }
+ while (className == null && count < 3);
+ try
+ {
+ Class<?> t =
+ Class.forName("gnu.xml.transform.TransformerFactoryImpl");
+ return (TransformerFactory) t.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new TransformerFactoryConfigurationError(e);
+ }
+ }
+
+ private static String getFactoryClassName(ClassLoader loader, int attempt)
+ {
+ final String propertyName = "javax.xml.transform.TransformerFactory";
+ switch (attempt)
+ {
+ case 0:
+ return System.getProperty(propertyName);
+ case 1:
+ try
+ {
+ File file = new File(System.getProperty("java.home"));
+ file = new File(file, "lib");
+ file = new File(file, "jaxp.properties");
+ InputStream in = new FileInputStream(file);
+ Properties props = new Properties();
+ props.load(in);
+ in.close();
+ return props.getProperty(propertyName);
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ case 2:
+ try
+ {
+ String serviceKey = "/META-INF/services/" + propertyName;
+ InputStream in = (loader != null) ?
+ loader.getResourceAsStream(serviceKey) :
+ TransformerFactory.class.getResourceAsStream(serviceKey);
+ if (in != null)
+ {
+ BufferedReader r =
+ new BufferedReader(new InputStreamReader(in));
+ String ret = r.readLine();
+ r.close();
+ return ret;
+ }
+ }
+ catch (IOException e)
+ {
+ }
+ return null;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Creates a new transformer using the specified stylesheet.
+ * @param source the source of an <a href='http://www.w3.org/TR/xslt'>XSLT
+ * stylesheet</a> specifying the transformation to apply
+ */
+ public abstract Transformer newTransformer(Source source)
+ throws TransformerConfigurationException;
+
+ /**
+ * Creates a new transformer that applies the identity transform.
+ */
+ public abstract Transformer newTransformer()
+ throws TransformerConfigurationException;
+
+ /**
+ * Creates a new compiled transformation using the specified stylesheet.
+ * @param source the source of an <a href='http://www.w3.org/TR/xslt'>XSLT
+ * stylesheet</a> specifying the transformation to apply
+ */
+ public abstract Templates newTemplates(Source source)
+ throws TransformerConfigurationException;
+
+ /**
+ * Returns a source object representing the XML resource specified by the
+ * <a href='http://www.w3.org/TR/xml-stylesheet/'>xml-stylesheet</a>
+ * processing instruction and matching the given criteria.
+ * Note that if multiple stylesheets are selected, the source represents a
+ * stylesheet composed of a list of imports.
+ * @param source the source XML document
+ * @param media the media attribute to match, or <code>null</code> to match
+ * the preferred templates
+ * @param title the title attribute to match, or <code>null</code> to match
+ * any
+ * @param charset the charset attribute to match, or <code>null</code> to
+ * match any
+ */
+ public abstract Source getAssociatedStylesheet(Source source,
+ String media,
+ String title,
+ String charset)
+ throws TransformerConfigurationException;
+
+ /**
+ * Set the resolver callback to be used by transformers obtained from
+ * this factory.
+ */
+ public abstract void setURIResolver(URIResolver resolver);
+
+ /**
+ * Returns the resolver callback to be used by transformers obtained from
+ * this factory.
+ */
+ public abstract URIResolver getURIResolver();
+
+ /**
+ * Sets a feature of transformers and templates obtained from this
+ * factory.
+ * Feature names are fully qualified URIs, and may depend on the factory
+ * implementation.
+ * @param name the name of the feature
+ * @param value the feature state
+ * @exception TransformerConfigurationException if the feature is
+ * unsupported
+ */
+ public abstract void setFeature(String name, boolean value)
+ throws TransformerConfigurationException;
+
+ /**
+ * Returns the state of a feature in the factory implementation.
+ * Feature names are fully qualified URIs, and may depend on the factory
+ * implementation. JAXP also predefines several features, including the
+ * constants in {@link javax.xml.XMLConstants} and
+ * <ul>
+ * <li>{@link javax.xml.transform.dom.DOMSource#FEATURE}</li>
+ * <li>{@link javax.xml.transform.dom.DOMResult#FEATURE}</li>
+ * <li>{@link javax.xml.transform.sax.SAXSource#FEATURE}</li>
+ * <li>{@link javax.xml.transform.sax.SAXResult#FEATURE}</li>
+ * <li>{@link javax.xml.transform.sax.SAXTransformerFactory#FEATURE}</li>
+ * <li>{@link javax.xml.transform.sax.SAXTransformerFactory#FEATURE_XMLFILTER}</li>
+ * <li>{@link javax.xml.transform.stream.StreamSource#FEATURE}</li>
+ * <li>{@link javax.xml.transform.stream.StreamResult#FEATURE}</li>
+ * </ul>
+ * The latter expose various capabilities of the factory implementation.
+ */
+ public abstract boolean getFeature(String name);
+
+ /**
+ * Set a named attribute on the underlying implementation.
+ * @param name the attribute name
+ * @param value the value to assign
+ * @exception IllegalArgumentException if the attribute is not supported
+ */
+ public abstract void setAttribute(String name, Object value)
+ throws IllegalArgumentException;
+
+ /**
+ * Retrieve the specified named attribute value.
+ * @param name the attribute name
+ * @exception IllegalArgumentException if the attribute is not supported
+ */
+ public abstract Object getAttribute(String name)
+ throws IllegalArgumentException;
+
+ /**
+ * Sets the callback to be used by transformers obtained from this factory
+ * to report transformation errors.
+ */
+ public abstract void setErrorListener(ErrorListener listener)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns the callback to be used by transformers obtained from this
+ * factory to report transformation errors.
+ */
+ public abstract ErrorListener getErrorListener();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
new file mode 100644
index 000000000..45e3d3928
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
@@ -0,0 +1,106 @@
+/* TransformerFactoryConfigurationError.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package javax.xml.transform;
+
+/**
+ * An error occurred during configuration of the transformer factory.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class TransformerFactoryConfigurationError
+ extends Error
+{
+ private static final long serialVersionUID = -6527718720676281516L;
+
+ // Name is fixed by the serialization spec.
+ private final Exception exception;
+
+ /**
+ * Constructor with no detail message.
+ */
+ public TransformerFactoryConfigurationError()
+ {
+ this(null, null);
+ }
+
+ /**
+ * Constructor with a detail message.
+ */
+ public TransformerFactoryConfigurationError(String msg)
+ {
+ this(null, msg);
+ }
+
+ /**
+ * Constructor with an underlying cause.
+ */
+ public TransformerFactoryConfigurationError(Exception e)
+ {
+ this(e, null);
+ }
+
+ /**
+ * Constructor with an underlying cause and detail message.
+ */
+ public TransformerFactoryConfigurationError(Exception e, String msg)
+ {
+ super(msg);
+ exception = e;
+ }
+
+ /**
+ * Returns the detail message.
+ */
+ public String getMessage()
+ {
+ String message = super.getMessage();
+ if (message == null && exception != null)
+ {
+ message = exception.getMessage();
+ }
+ return message;
+ }
+
+ /**
+ * Returns the underlying cause.
+ */
+ public Exception getException()
+ {
+ return exception;
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/URIResolver.java b/libjava/classpath/javax/xml/transform/URIResolver.java
new file mode 100644
index 000000000..e6315bba4
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/URIResolver.java
@@ -0,0 +1,58 @@
+/* URIResolver.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package javax.xml.transform;
+
+/**
+ * Callback that can resolve a URI into source XML for transformation.
+ * Equivalent to the SAX EntityResolver.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface URIResolver
+{
+
+ /**
+ * Resolves an <code>xsl:include</code>, <code>xsl:import</code>, or
+ * XPath <code>document()</code> function.
+ * @param href the URI to resolve (relative or absolute)
+ * @param base the base URI relative to which the URI is to be resolved
+ * @return a source, or null if the resource could not be found
+ */
+ public Source resolve(String href, String base)
+ throws TransformerException;
+
+}
diff --git a/libjava/classpath/javax/xml/transform/dom/DOMLocator.java b/libjava/classpath/javax/xml/transform/dom/DOMLocator.java
new file mode 100644
index 000000000..acea08e57
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/dom/DOMLocator.java
@@ -0,0 +1,57 @@
+/* DOMLocator.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.dom;
+
+import javax.xml.transform.SourceLocator;
+import org.w3c.dom.Node;
+
+/**
+ * Locator for reporting a location in a W3C DOM object graph.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface DOMLocator
+ extends SourceLocator
+{
+
+ /**
+ * Returns the node on which the event originated.
+ */
+ public Node getOriginatingNode();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/dom/DOMResult.java b/libjava/classpath/javax/xml/transform/dom/DOMResult.java
new file mode 100644
index 000000000..7577f2d98
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/dom/DOMResult.java
@@ -0,0 +1,163 @@
+/* DOMResult.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.dom;
+
+import javax.xml.transform.Result;
+import org.w3c.dom.Node;
+
+/**
+ * Output result specified as a W3C DOM object graph.
+ * The result tree may be appended to an existing tree.
+ * If no target node is specified, the result tree will be made available by
+ * the {@link #getNode} method after the transformation.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class DOMResult
+ implements Result
+{
+
+ /**
+ * Factory feature indicating that DOM results are supported.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.dom.DOMResult/feature";
+
+ private Node node;
+ private Node nextSibling;
+ private String systemId;
+
+ /**
+ * Default constructor.
+ */
+ public DOMResult()
+ {
+ this(null, null, null);
+ }
+
+ /**
+ * Constructor with the node to append to.
+ */
+ public DOMResult(Node node)
+ {
+ this(node, null, null);
+ }
+
+ /**
+ * Constructor with the node to append to and the child node before which
+ * the result should be appended.
+ * @since 1.3
+ */
+ public DOMResult(Node node, Node nextSibling)
+ {
+ this(node, nextSibling, null);
+ }
+
+ /**
+ * Constructor with the node to append to and the system ID.
+ */
+ public DOMResult(Node node, String systemID)
+ {
+ this(node, null, systemID);
+ }
+
+ /**
+ * Constructor with the node to append to, the child node before which
+ * the result should be appended, and the system ID.
+ * @since 1.3
+ */
+ public DOMResult(Node node, Node nextSibling, String systemID)
+ {
+ this.node = node;
+ this.nextSibling = nextSibling;
+ this.systemId = systemID;
+ }
+
+ /**
+ * Sets the node to which the result tree will be appended.
+ * @param node the node
+ */
+ public void setNode(Node node)
+ {
+ this.node = node;
+ }
+
+ /**
+ * Returns the node to which the result tree is to be appended,
+ * or the result tree after transformation if no node was previously set.
+ */
+ public Node getNode()
+ {
+ return node;
+ }
+
+ /**
+ * Sets the child node before which the result nodes will be inserted.
+ * @since 1.3
+ */
+ public void setNextSibling(Node nextSibling)
+ {
+ this.nextSibling = nextSibling;
+ }
+
+ /**
+ * Returns the child node before which the result nodes will be inserted.
+ * @since 1.3
+ */
+ public Node getNextSibling()
+ {
+ return nextSibling;
+ }
+
+ /**
+ * Sets the system ID used to resolve external entities.
+ */
+ public void setSystemId(String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+ /**
+ * Returns the system ID used to resolve external entities.
+ */
+ public String getSystemId()
+ {
+ return systemId;
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/dom/DOMSource.java b/libjava/classpath/javax/xml/transform/dom/DOMSource.java
new file mode 100644
index 000000000..5922665a0
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/dom/DOMSource.java
@@ -0,0 +1,118 @@
+/* DOMSource.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.dom;
+
+import javax.xml.transform.Source;
+import org.w3c.dom.Node;
+
+/**
+ * An XML source specified as a W3C DOM node context.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class DOMSource
+ implements Source
+{
+
+ /**
+ * Factory feature indicating that DOM sources are supported.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.dom.DOMSource/feature";
+
+ private Node node;
+ private String systemId;
+
+ /**
+ * Default constructor.
+ */
+ public DOMSource()
+ {
+ this(null, null);
+ }
+
+ /**
+ * Constructor with a context node.
+ */
+ public DOMSource(Node node)
+ {
+ this(node, null);
+ }
+
+ /**
+ * Constructor with a context node and system ID.
+ */
+ public DOMSource(Node node, String systemId)
+ {
+ this.node = node;
+ this.systemId = systemId;
+ }
+
+ /**
+ * Sets the context node.
+ */
+ public void setNode(Node node)
+ {
+ this.node = node;
+ }
+
+ /**
+ * Returns the context node.
+ */
+ public Node getNode()
+ {
+ return node;
+ }
+
+ /**
+ * Sets the base URI to use as the context for resolving entities.
+ */
+ public void setSystemId(String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+ /**
+ * Returns the base URI to use as the context for resolving entities.
+ */
+ public String getSystemId()
+ {
+ return systemId;
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/dom/package.html b/libjava/classpath/javax/xml/transform/dom/package.html
new file mode 100644
index 000000000..0600fc724
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/dom/package.html
@@ -0,0 +1,5 @@
+<html><head>trax for dom</head><body>
+
+<p>Support for DOM inputs and outputs to transformers.
+
+</body></html>
diff --git a/libjava/classpath/javax/xml/transform/package.html b/libjava/classpath/javax/xml/transform/package.html
new file mode 100644
index 000000000..bc67c2b80
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/package.html
@@ -0,0 +1,38 @@
+<html><head>trax </head><body>
+
+<p>Base "TRAX" API for XSLT transformers.
+This API borrows many structural notions from SAX,
+such as the way error handling and external entity
+resolution are handled, although it does not reuse
+the corresponding SAX classes.
+To use XSLT transformers: <ul>
+
+<li>Start with <em>TransformerFactory.newInstance()</em>;
+
+<li>Then you may wish to configure that factory through
+its features and properties. This includes modifying
+the way errors are handled and URIs are resolved.
+
+<li>Then you have several options for how to perform
+the XSLT transformations. One generic option is to ask the
+factory for a <a href="Transformer.html">Transformer</a>
+and then use <em>Transformer.transform()</em> to pull
+input text onto output text.
+
+<li>Alternatively, most factories support flexible integration
+with SAX event streams. You can cast such factories to a
+<a href="sax/SAXTransformerFactory.html">SAXTransformerFactory</a>
+and perform either push or pull mode transformations.
+
+</ul>
+
+<p>The <a href="OutputKeys.html">OutputKeys</a> class
+holds constants that can be used to configure output
+properties used with <em>Result</em> objects, as if
+they were specified in <em>xslt:output</em> attributes
+in the stylesheet specifying the transform.
+
+<p>The <a href="Templates.html">Templates</a> class
+accomodates the notion of "compiled" transforms.
+
+</body></html>
diff --git a/libjava/classpath/javax/xml/transform/sax/SAXResult.java b/libjava/classpath/javax/xml/transform/sax/SAXResult.java
new file mode 100644
index 000000000..265b9512c
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/sax/SAXResult.java
@@ -0,0 +1,132 @@
+/* SAXResult.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.Result;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * Specifies SAX handlers to be used as a result sink during a
+ * transformation.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class SAXResult implements Result
+{
+
+ /**
+ * Factory feature indicating that SAX results are supported.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.sax.SAXResult/feature";
+
+ private ContentHandler handler;
+ private LexicalHandler lexicalHandler;
+ private String systemId;
+
+ /**
+ * Default constructor.
+ */
+ public SAXResult()
+ {
+ }
+
+ /**
+ * Constructor specifying a content handler.
+ */
+ public SAXResult(ContentHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ /**
+ * Sets the content handler to which result document events will be
+ * propagated.
+ */
+ public void setHandler(ContentHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ /**
+ * Returns the content handler to which result document events will be
+ * propagated.
+ */
+ public ContentHandler getHandler()
+ {
+ return handler;
+ }
+
+ /**
+ * Sets the lexical handler to which lexical events will be propagated.
+ * If a lexical handler is not set, the transformer should attempt to cast
+ * the content handler to a lexical handler.
+ */
+ public void setLexicalHandler(LexicalHandler handler)
+ {
+ lexicalHandler = handler;
+ }
+
+ /**
+ * Returns the lexical handler to which lexical events will be propagated.
+ * If a lexical handler is not set, the transformer should attempt to cast
+ * the content handler to a lexical handler.
+ */
+ public LexicalHandler getLexicalHandler()
+ {
+ return lexicalHandler;
+ }
+
+ /**
+ * Sets the system ID which this result represents.
+ */
+ public void setSystemId(String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+ /**
+ * Returns the system ID which this result represnts.
+ */
+ public String getSystemId()
+ {
+ return systemId;
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/sax/SAXSource.java b/libjava/classpath/javax/xml/transform/sax/SAXSource.java
new file mode 100644
index 000000000..1ef4b7391
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/sax/SAXSource.java
@@ -0,0 +1,197 @@
+/* SAXSource.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.sax;
+
+import java.io.InputStream;
+import java.io.Reader;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * Specifies a SAX XML source. This is a tuple of input source and SAX
+ * parser.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class SAXSource
+ implements Source
+{
+
+ /**
+ * Factory feature indicating that SAX sources are supported.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.sax.SAXSource/feature";
+
+ private XMLReader xmlReader;
+ private InputSource inputSource;
+
+ /**
+ * Default constructor.
+ */
+ public SAXSource()
+ {
+ }
+
+ /**
+ * Constructor with a SAX parser and input source.
+ */
+ public SAXSource(XMLReader reader, InputSource inputSource)
+ {
+ xmlReader = reader;
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Constructor with an input source.
+ * The SAX parser will be instantiated by the transformer.
+ */
+ public SAXSource(InputSource inputSource)
+ {
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Sets the SAX parser to be used by this source.
+ * If null, the transformer will instantiate its own parser.
+ */
+ public void setXMLReader(XMLReader reader)
+ {
+ xmlReader = reader;
+ }
+
+ /**
+ * Returns the SAX parser to be used by this source.
+ * If null, the transformer will instantiate its own parser.
+ */
+ public XMLReader getXMLReader()
+ {
+ return xmlReader;
+ }
+
+ /**
+ * Sets the input source to parse.
+ */
+ public void setInputSource(InputSource inputSource)
+ {
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Returns the input source to parse.
+ */
+ public InputSource getInputSource()
+ {
+ return inputSource;
+ }
+
+ /**
+ * Sets the system ID for this source.
+ */
+ public void setSystemId(String systemId)
+ {
+ if (inputSource != null)
+ {
+ inputSource.setSystemId(systemId);
+ }
+ }
+
+ /**
+ * Returns the system ID for this source.
+ */
+ public String getSystemId()
+ {
+ if (inputSource != null)
+ {
+ return inputSource.getSystemId();
+ }
+ return null;
+ }
+
+ /**
+ * Converts a source into a SAX input source.
+ * This method can use a StreamSource or the system ID.
+ * @return an input source or null
+ */
+ public static InputSource sourceToInputSource(Source source)
+ {
+ InputSource in = null;
+ if (source instanceof SAXSource)
+ {
+ in = ((SAXSource) source).getInputSource();
+ }
+ else if (source instanceof StreamSource)
+ {
+ StreamSource streamSource = (StreamSource) source;
+ InputStream inputStream = streamSource.getInputStream();
+ if (inputStream != null)
+ {
+ in = new InputSource(inputStream);
+ }
+ else
+ {
+ Reader reader = streamSource.getReader();
+ if (reader != null)
+ {
+ in = new InputSource(reader);
+ }
+ }
+ String publicId = streamSource.getPublicId();
+ if (publicId != null && in != null)
+ {
+ in.setPublicId(publicId);
+ }
+ }
+ String systemId = source.getSystemId();
+ if (systemId != null)
+ {
+ if (in == null)
+ {
+ in = new InputSource(systemId);
+ }
+ else
+ {
+ in.setSystemId(systemId);
+ }
+ }
+ return in;
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/sax/SAXTransformerFactory.java b/libjava/classpath/javax/xml/transform/sax/SAXTransformerFactory.java
new file mode 100644
index 000000000..2e3713760
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/sax/SAXTransformerFactory.java
@@ -0,0 +1,115 @@
+/* SAXTransformerFactory.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import org.xml.sax.XMLFilter;
+
+/**
+ * Specialized transformer factory with support for SAX-specific factory
+ * methods.
+ * This factory provides SAX content handlers that can create transformation
+ * templates and transformers.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public abstract class SAXTransformerFactory extends TransformerFactory
+{
+
+ /**
+ * Factory feature indicating that the factory can be cast to this class.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.sax.SAXTransformerFactory/feature";
+
+ /**
+ * Factory feature indicating that this factory can create new XMLFilters.
+ */
+ public static final String FEATURE_XMLFILTER =
+ "http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter";
+
+ protected SAXTransformerFactory()
+ {
+ }
+
+ /**
+ * Returns a content handler that can process SAX events into a result,
+ * using the specified transformation.
+ * @param src the source stylesheet
+ */
+ public abstract TransformerHandler newTransformerHandler(Source src)
+ throws TransformerConfigurationException;
+
+ /**
+ * Returns a content handler that can process SAX events into a result,
+ * using the specified transformation.
+ * @param templates the compiled stylesheet
+ */
+ public abstract TransformerHandler newTransformerHandler(Templates templates)
+ throws TransformerConfigurationException;
+
+ /**
+ * Returns a content handler that can process SAX events into a result,
+ * using the identity transform.
+ */
+ public abstract TransformerHandler newTransformerHandler()
+ throws TransformerConfigurationException;
+
+ /**
+ * Returns a content handler that can process SAX events into a
+ * transformation template.
+ */
+ public abstract TemplatesHandler newTemplatesHandler()
+ throws TransformerConfigurationException;
+
+ /**
+ * Creates an XML filter for the specified source.
+ */
+ public abstract XMLFilter newXMLFilter(Source src)
+ throws TransformerConfigurationException;
+
+ /**
+ * Creates an XML filter for the specified compiled stylesheet.
+ */
+ public abstract XMLFilter newXMLFilter(Templates templates)
+ throws TransformerConfigurationException;
+
+}
diff --git a/libjava/classpath/javax/xml/transform/sax/TemplatesHandler.java b/libjava/classpath/javax/xml/transform/sax/TemplatesHandler.java
new file mode 100644
index 000000000..86d46aceb
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/sax/TemplatesHandler.java
@@ -0,0 +1,68 @@
+/* TemplatesHandler.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.Templates;
+import org.xml.sax.ContentHandler;
+
+/**
+ * A content handler that processes SAX parse events into a compiled
+ * transformation template.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface TemplatesHandler
+ extends ContentHandler
+{
+
+ /**
+ * Returns the templates object created by the parsing of the SAX events.
+ */
+ public Templates getTemplates();
+
+ /**
+ * Sets the system ID for the templates object created by this processor.
+ */
+ public void setSystemId(String systemId);
+
+ /**
+ * Returns the system ID for the templates object created by this processor.
+ */
+ public String getSystemId();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/sax/TransformerHandler.java b/libjava/classpath/javax/xml/transform/sax/TransformerHandler.java
new file mode 100644
index 000000000..aae56e2a9
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/sax/TransformerHandler.java
@@ -0,0 +1,78 @@
+/* TransformerHandler.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * A content handler that transforms SAX events into a result tree.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public interface TransformerHandler
+ extends ContentHandler, LexicalHandler, DTDHandler
+{
+
+ /**
+ * Sets the result sink to be used as the output of the transformation.
+ * @exception IllegalArgumentException if the result is not a valid target
+ */
+ public void setResult(Result result)
+ throws IllegalArgumentException;
+
+ /**
+ * Sets the system ID relative to which URLs will be resolved.
+ */
+ public void setSystemId(String systemID);
+
+ /**
+ * Returns the system ID relative to which URLs will be resolved.
+ */
+ public String getSystemId();
+
+ /**
+ * Returns the transformer associated with this handler in order to set
+ * parameters and output properties.
+ */
+ public Transformer getTransformer();
+
+}
diff --git a/libjava/classpath/javax/xml/transform/sax/package.html b/libjava/classpath/javax/xml/transform/sax/package.html
new file mode 100644
index 000000000..b2d2978a3
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/sax/package.html
@@ -0,0 +1,9 @@
+<html><head>trax for sax</head><body>
+
+<p>Support for SAX2-based XSLT transformers.
+Normally you would cast a TransformerFactory to a
+<a href="SAXTransformerFactory.html">SAXTransformerFactory</a>
+and use that to in any of the various modes supported
+(such as push or pull).
+
+</body></html>
diff --git a/libjava/classpath/javax/xml/transform/stream/StreamResult.java b/libjava/classpath/javax/xml/transform/stream/StreamResult.java
new file mode 100644
index 000000000..b44e6ce58
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/stream/StreamResult.java
@@ -0,0 +1,173 @@
+/* StreamResult.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.stream;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import javax.xml.transform.Result;
+
+/**
+ * Specifies a stream to which to write the transformation result.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class StreamResult
+ implements Result
+{
+
+ /**
+ * Factory feature indicating that stream results are supported.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.stream.StreamResult/feature";
+
+ private String systemId;
+ private OutputStream outputStream;
+ private Writer writer;
+
+ /**
+ * Default constructor.
+ */
+ public StreamResult()
+ {
+ }
+
+ /**
+ * Constructor with an output stream.
+ */
+ public StreamResult(OutputStream stream)
+ {
+ this.outputStream = stream;
+ }
+
+ /**
+ * Constructor with a writer.
+ * Prefer to use an output stream rather than a writer, so that the
+ * output encoding can be controlled by transformation properties.
+ */
+ public StreamResult(Writer writer)
+ {
+ this.writer = writer;
+ }
+
+ /**
+ * Constructor with a system ID.
+ */
+ public StreamResult(String systemID)
+ {
+ this.systemId = systemID;
+ }
+
+ /**
+ * Constructor with a system ID specified as a File object.
+ */
+ public StreamResult(File file)
+ {
+ setSystemId(file);
+ }
+
+ /**
+ * Sets the target output stream.
+ */
+ public void setOutputStream(OutputStream outputStream)
+ {
+ this.outputStream = outputStream;
+ }
+
+ /**
+ * Returns the target output stream.
+ */
+ public OutputStream getOutputStream()
+ {
+ return outputStream;
+ }
+
+ /**
+ * Sets the target writer.
+ * Prefer to use an output stream rather than a writer, so that the
+ * output encoding can be controlled by transformation properties.
+ */
+ public void setWriter(Writer writer)
+ {
+ this.writer = writer;
+ }
+
+ /**
+ * Returns the target writer.
+ */
+ public Writer getWriter()
+ {
+ return writer;
+ }
+
+ /**
+ * Sets the system ID.
+ * If neither the out stream nor the writer have been specified, the
+ * system ID will be treated as a URL for writing to.
+ */
+ public void setSystemId(String systemID)
+ {
+ this.systemId = systemID;
+ }
+
+ /**
+ * Sets the system ID from a File reference.
+ */
+ public void setSystemId(File f)
+ {
+ try
+ {
+ systemId = f.toURL().toString();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Returns the system ID.
+ */
+ public String getSystemId()
+ {
+ return systemId;
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/stream/StreamSource.java b/libjava/classpath/javax/xml/transform/stream/StreamSource.java
new file mode 100644
index 000000000..def73d8c0
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/stream/StreamSource.java
@@ -0,0 +1,210 @@
+/* StreamSource.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.transform.stream;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.Reader;
+import javax.xml.transform.Source;
+
+/**
+ * Specifies a stream from which to read the source XML data.
+ *
+ * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
+ */
+public class StreamSource
+ implements Source
+{
+
+ /**
+ * Factory feature indicating that stream sources are supported.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.stream.StreamSource/feature";
+
+ private String publicId;
+ private String systemId;
+ private InputStream inputStream;
+ private Reader reader;
+
+ /**
+ * Default constructor.
+ */
+ public StreamSource()
+ {
+ }
+
+ /**
+ * Constructor with an input stream.
+ */
+ public StreamSource(InputStream stream)
+ {
+ this.inputStream = stream;
+ }
+
+ /**
+ * Constructor with an input stream and system ID.
+ */
+ public StreamSource(InputStream stream, String systemId)
+ {
+ this.inputStream = stream;
+ this.systemId = systemId;
+ }
+
+ /**
+ * Constructor with a reader.
+ * Prefer an input stream to a reader, so that the parser can use the
+ * character encoding specified in the XML.
+ */
+ public StreamSource(Reader reader)
+ {
+ this.reader = reader;
+ }
+
+ /**
+ * Constructor with a reader and system ID.
+ * Prefer an input stream to a reader, so that the parser can use the
+ * character encoding specified in the XML.
+ */
+ public StreamSource(Reader reader, String systemId)
+ {
+ this.reader = reader;
+ this.systemId = systemId;
+ }
+
+ /**
+ * Constructor with a system ID.
+ */
+ public StreamSource(String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+ /**
+ * Constructor with a system ID specified as a File reference.
+ */
+ public StreamSource(File file)
+ {
+ setSystemId(file);
+ }
+
+ /**
+ * Sets the source input stream.
+ */
+ public void setInputStream(InputStream stream)
+ {
+ this.inputStream = stream;
+ }
+
+ /**
+ * Returns the source input stream.
+ */
+ public InputStream getInputStream()
+ {
+ return inputStream;
+ }
+
+ /**
+ * Sets the source reader.
+ * Prefer an input stream to a reader, so that the parser can use the
+ * character encoding specified in the XML.
+ */
+ public void setReader(Reader reader)
+ {
+ this.reader = reader;
+ }
+
+ /**
+ * Returns the source reader.
+ */
+ public Reader getReader()
+ {
+ return reader;
+ }
+
+ /**
+ * Sets the public ID for this source.
+ */
+ public void setPublicId(String publicId)
+ {
+ this.publicId = publicId;
+ }
+
+ /**
+ * Returns the public ID for this source.
+ */
+ public String getPublicId()
+ {
+ return publicId;
+ }
+
+ /**
+ * Sets the system ID for this source.
+ * If the input stream and reader are absent, the system ID will be used
+ * as a readable URL to locate the source data.
+ */
+ public void setSystemId(String systemId)
+ {
+ this.systemId = systemId;
+ }
+
+ /**
+ * Returns the system ID for this source.
+ */
+ public String getSystemId()
+ {
+ return systemId;
+ }
+
+ /**
+ * Sets the system ID using a File reference.
+ */
+ public void setSystemId(File f)
+ {
+ try
+ {
+ this.systemId = f.toURL().toString();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/xml/transform/stream/package.html b/libjava/classpath/javax/xml/transform/stream/package.html
new file mode 100644
index 000000000..f9d052b19
--- /dev/null
+++ b/libjava/classpath/javax/xml/transform/stream/package.html
@@ -0,0 +1,6 @@
+<html><head>trax for streams</head><body>
+
+<p>Support for text stream inputs and outputs to transformers.
+
+</body></html>
+