summaryrefslogtreecommitdiffstats
path: root/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform')
-rw-r--r--sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Result.java70
-rw-r--r--sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Source.java36
-rw-r--r--sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/dom/DOMSource.java122
-rw-r--r--sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/sax/SAXSource.java195
4 files changed, 423 insertions, 0 deletions
diff --git a/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Result.java b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Result.java
new file mode 100644
index 0000000000..dd3517c8cc
--- /dev/null
+++ b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Result.java
@@ -0,0 +1,70 @@
+// $Id: Result.java,v 1.2 2003/10/22 03:53:16 jsuttor Exp $
+
+/*
+ * @(#)Result.java 1.13 04/07/26
+ *
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+package javax.xml.transform;
+
+/**
+ * <p>An object that implements this interface contains the information
+ * needed to build a transformation result tree.</p>
+ *
+ * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
+ */
+public interface Result {
+
+ /**
+ * The name of the processing instruction that is sent if the
+ * result tree disables output escaping.
+ *
+ * <p>Normally, result tree serialization escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output that is
+ * almost, but not quite well-formed XML; for example,
+ * the output may include ill-formed sections that will
+ * be transformed into well-formed XML by a subsequent non-XML aware
+ * process. If a processing instruction is sent with this name,
+ * serialization should be output without any escaping. </p>
+ *
+ * <p>Result DOM trees may also have PI_DISABLE_OUTPUT_ESCAPING and
+ * PI_ENABLE_OUTPUT_ESCAPING inserted into the tree.</p>
+ *
+ * @see <a href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping in XSLT Specification</a>
+ */
+ public static final String PI_DISABLE_OUTPUT_ESCAPING =
+ "javax.xml.transform.disable-output-escaping";
+
+ /**
+ * The name of the processing instruction that is sent
+ * if the result tree enables output escaping at some point after having
+ * received a PI_DISABLE_OUTPUT_ESCAPING processing instruction.
+ *
+ * @see <a href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping in XSLT Specification</a>
+ */
+ public static final String PI_ENABLE_OUTPUT_ESCAPING =
+ "javax.xml.transform.enable-output-escaping";
+
+ /**
+ * Set the system identifier for this Result.
+ *
+ * <p>If the Result is not to be written to a file, the system identifier is optional.
+ * The application may still want to provide one, however, for use in error messages
+ * and warnings, or to resolve relative output identifiers.</p>
+ *
+ * @param systemId The system identifier as a URI string.
+ */
+ public void setSystemId(String systemId);
+
+ /**
+ * Get the system identifier that was set with setSystemId.
+ *
+ * @return The system identifier that was set with setSystemId,
+ * or null if setSystemId was not called.
+ */
+ public String getSystemId();
+}
diff --git a/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Source.java b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Source.java
new file mode 100644
index 0000000000..5467229cc7
--- /dev/null
+++ b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/Source.java
@@ -0,0 +1,36 @@
+// $Id: Source.java,v 1.2 2003/09/07 23:02:09 jsuttor Exp $
+/*
+ * @(#)Source.java 1.14 04/07/26
+ *
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+package javax.xml.transform;
+
+/**
+ * An object that implements this interface contains the information
+ * needed to act as source input (XML source or transformation instructions).
+ */
+public interface Source {
+
+ /**
+ * Set the system identifier for this Source.
+ *
+ * <p>The system identifier is optional if the source does not
+ * get its data from a URL, but it may still be useful to provide one.
+ * The application can use a system identifier, for example, to resolve
+ * relative URIs and to include in error messages and warnings.</p>
+ *
+ * @param systemId The system identifier as a URL string.
+ */
+ public void setSystemId(String systemId);
+
+ /**
+ * Get the system identifier that was set with setSystemId.
+ *
+ * @return The system identifier that was set with setSystemId, or null
+ * if setSystemId was not called.
+ */
+ public String getSystemId();
+}
diff --git a/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/dom/DOMSource.java b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/dom/DOMSource.java
new file mode 100644
index 0000000000..a55864a04c
--- /dev/null
+++ b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/dom/DOMSource.java
@@ -0,0 +1,122 @@
+// $Id: DOMSource.java,v 1.5.14.1.2.2 2004/07/13 22:27:49 jsuttor Exp $
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+/*
+ * @(#)DOMSource.java 1.16 04/07/13
+ */
+package javax.xml.transform.dom;
+
+import javax.xml.transform.Source;
+
+import org.w3c.dom.Node;
+
+/**
+ * <p>Acts as a holder for a transformation Source tree in the
+ * form of a Document Object Model (DOM) tree.</p>
+ *
+ * <p>Note that XSLT requires namespace support. Attempting to transform a DOM
+ * that was not contructed with a namespace-aware parser may result in errors.
+ * Parsers can be made namespace aware by calling
+ * {@link javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean awareness)}.</p>
+ *
+ * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
+ * @version $Revision: 1.5.14.1.2.2 $, $Date: 2004/07/13 22:27:49 $
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2">Document Object Model (DOM) Level 2 Specification</a>
+ */
+public class DOMSource implements Source {
+
+ /**
+ * <p><code>Node</code> to serve as DOM source.</p>
+ */
+ private Node node;
+
+ /**
+ * <p>The base ID (URL or system ID) from where URLs
+ * will be resolved.</p>
+ */
+ private String systemID;
+
+ /** If {@link javax.xml.transform.TransformerFactory#getFeature}
+ * returns true when passed this value as an argument,
+ * the Transformer supports Source input of this type.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.dom.DOMSource/feature";
+
+ /**
+ * <p>Zero-argument default constructor. If this constructor is used, and
+ * no DOM source is set using {@link #setNode(Node node)} , then the
+ * <code>Transformer</code> will
+ * create an empty source {@link org.w3c.dom.Document} using
+ * {@link javax.xml.parsers.DocumentBuilder#newDocument()}.</p>
+ *
+ * @see javax.xml.transform.Transformer#transform(Source xmlSource, Result outputTarget)
+ */
+ public DOMSource() { }
+
+ /**
+ * Create a new input source with a DOM node. The operation
+ * will be applied to the subtree rooted at this node. In XSLT,
+ * a "/" pattern still means the root of the tree (not the subtree),
+ * and the evaluation of global variables and parameters is done
+ * from the root node also.
+ *
+ * @param n The DOM node that will contain the Source tree.
+ */
+ public DOMSource(Node n) {
+ setNode(n);
+ }
+
+ /**
+ * Create a new input source with a DOM node, and with the
+ * system ID also passed in as the base URI.
+ *
+ * @param node The DOM node that will contain the Source tree.
+ * @param systemID Specifies the base URI associated with node.
+ */
+ public DOMSource(Node node, String systemID) {
+ setNode(node);
+ setSystemId(systemID);
+ }
+
+ /**
+ * Set the node that will represents a Source DOM tree.
+ *
+ * @param node The node that is to be transformed.
+ */
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+ /**
+ * Get the node that represents a Source DOM tree.
+ *
+ * @return The node that is to be transformed.
+ */
+ public Node getNode() {
+ return node;
+ }
+
+ /**
+ * Set the base ID (URL or system ID) from where URLs
+ * will be resolved.
+ *
+ * @param systemID Base URL for this DOM tree.
+ */
+ public void setSystemId(String systemID) {
+ this.systemID = systemID;
+ }
+
+ /**
+ * Get the base ID (URL or system ID) from where URLs
+ * will be resolved.
+ *
+ * @return Base URL for this DOM tree.
+ */
+ public String getSystemId() {
+ return this.systemID;
+ }
+}
diff --git a/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/sax/SAXSource.java b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/sax/SAXSource.java
new file mode 100644
index 0000000000..cc09fee0ae
--- /dev/null
+++ b/sandbox/mobile-android/android-jdk-classes/src/javax/xml/transform/sax/SAXSource.java
@@ -0,0 +1,195 @@
+// $Id: SAXSource.java,v 1.7.14.1.2.2 2004/07/13 22:27:50 jsuttor Exp $
+/*
+ * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+/*
+ * @(#)SAXSource.java 1.15 04/07/13
+ */
+package javax.xml.transform.sax;
+
+import javax.xml.transform.Source;
+//import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * <p>Acts as an holder for SAX-style Source.</p>
+ *
+ * <p>Note that XSLT requires namespace support. Attempting to transform an
+ * input source that is not
+ * generated with a namespace-aware parser may result in errors.
+ * Parsers can be made namespace aware by calling the
+ * {@link javax.xml.parsers.SAXParserFactory#setNamespaceAware(boolean awareness)} method.</p>
+ *
+ * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
+ * @version $Revision: 1.7.14.1.2.2 $, $Date: 2004/07/13 22:27:50 $
+ */
+public class SAXSource implements Source {
+
+ /**
+ * If {@link javax.xml.transform.TransformerFactory#getFeature}
+ * returns true when passed this value as an argument,
+ * the Transformer supports Source input of this type.
+ */
+ public static final String FEATURE =
+ "http://javax.xml.transform.sax.SAXSource/feature";
+
+ /**
+ * <p>Zero-argument default constructor. If this constructor is used, and
+ * no SAX source is set using
+ * {@link #setInputSource(InputSource inputSource)} , then the
+ * <code>Transformer</code> will
+ * create an empty source {@link org.xml.sax.InputSource} using
+ * {@link org.xml.sax.InputSource#InputSource() new InputSource()}.</p>
+ *
+ * @see javax.xml.transform.Transformer#transform(Source xmlSource, Result outputTarget)
+ */
+ public SAXSource() { }
+
+ /**
+ * Create a <code>SAXSource</code>, using an {@link org.xml.sax.XMLReader}
+ * and a SAX InputSource. The {@link javax.xml.transform.Transformer}
+ * or {@link javax.xml.transform.sax.SAXTransformerFactory} will set itself
+ * to be the reader's {@link org.xml.sax.ContentHandler}, and then will call
+ * reader.parse(inputSource).
+ *
+ * @param reader An XMLReader to be used for the parse.
+ * @param inputSource A SAX input source reference that must be non-null
+ * and that will be passed to the reader parse method.
+ */
+ public SAXSource(XMLReader reader, InputSource inputSource) {
+ this.reader = reader;
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Create a <code>SAXSource</code>, using a SAX <code>InputSource</code>.
+ * The {@link javax.xml.transform.Transformer} or
+ * {@link javax.xml.transform.sax.SAXTransformerFactory} creates a
+ * reader via {@link org.xml.sax.helpers.XMLReaderFactory}
+ * (if setXMLReader is not used), sets itself as
+ * the reader's {@link org.xml.sax.ContentHandler}, and calls
+ * reader.parse(inputSource).
+ *
+ * @param inputSource An input source reference that must be non-null
+ * and that will be passed to the parse method of the reader.
+ */
+ public SAXSource(InputSource inputSource) {
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Set the XMLReader to be used for the Source.
+ *
+ * @param reader A valid XMLReader or XMLFilter reference.
+ */
+ public void setXMLReader(XMLReader reader) {
+ this.reader = reader;
+ }
+
+ /**
+ * Get the XMLReader to be used for the Source.
+ *
+ * @return A valid XMLReader or XMLFilter reference, or null.
+ */
+ public XMLReader getXMLReader() {
+ return reader;
+ }
+
+ /**
+ * Set the SAX InputSource to be used for the Source.
+ *
+ * @param inputSource A valid InputSource reference.
+ */
+ public void setInputSource(InputSource inputSource) {
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Get the SAX InputSource to be used for the Source.
+ *
+ * @return A valid InputSource reference, or null.
+ */
+ public InputSource getInputSource() {
+ return inputSource;
+ }
+
+ /**
+ * Set the system identifier for this Source. If an input source
+ * has already been set, it will set the system ID or that
+ * input source, otherwise it will create a new input source.
+ *
+ * <p>The system identifier is optional if there is a byte stream
+ * or a character stream, but it is still useful to provide one,
+ * since the application can use it to resolve relative URIs
+ * and can include it in error messages and warnings (the parser
+ * will attempt to open a connection to the URI only if
+ * no byte stream or character stream is specified).</p>
+ *
+ * @param systemId The system identifier as a URI string.
+ */
+ public void setSystemId(String systemId) {
+
+ if (null == inputSource) {
+ inputSource = new InputSource(systemId);
+ } else {
+ inputSource.setSystemId(systemId);
+ }
+ }
+
+ /**
+ * <p>Get the base ID (URI or system ID) from where URIs
+ * will be resolved.</p>
+ *
+ * @return Base URL for the <code>Source</code>, or <code>null</code>.
+ */
+ public String getSystemId() {
+
+ if (inputSource == null) {
+ return null;
+ } else {
+ return inputSource.getSystemId();
+ }
+ }
+
+ /**
+ * The XMLReader to be used for the source tree input. May be null.
+ */
+ private XMLReader reader;
+
+ /**
+ * <p>The SAX InputSource to be used for the source tree input.
+ * Should not be <code>null<code>.</p>
+ */
+ private InputSource inputSource;
+/*
+ *//**
+ * Attempt to obtain a SAX InputSource object from a Source
+ * object.
+ *
+ * @param source Must be a non-null Source reference.
+ *
+ * @return An InputSource, or null if Source can not be converted.
+ *//*
+ public static InputSource sourceToInputSource(Source source) {
+
+ if (source instanceof SAXSource) {
+ return ((SAXSource) source).getInputSource();
+ } else if (source instanceof StreamSource) {
+ StreamSource ss = (StreamSource) source;
+ InputSource isource = new InputSource(ss.getSystemId());
+
+ isource.setByteStream(ss.getInputStream());
+ isource.setCharacterStream(ss.getReader());
+ isource.setPublicId(ss.getPublicId());
+
+ return isource;
+ } else {
+ return null;
+ }
+ }*/
+}
+