minchau 2004/08/13 14:08:28
Modified: java/src/org/apache/xalan/lib Redirect.java
Log:
PR: 30658
Submitted by: Brian Minchau
Reviewed by: Morris Kwan
Revision Changes Path
1.23 +56 -3 xml-xalan/java/src/org/apache/xalan/lib/Redirect.java
Index: Redirect.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/Redirect.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Redirect.java 18 Feb 2004 23:51:20 -0000 1.22
+++ Redirect.java 13 Aug 2004 21:08:27 -0000 1.23
@@ -209,9 +209,13 @@
TransformerImpl transf = context.getTransformer();
+ startRedirection(transf, formatter); // for tracing only
+
transf.executeChildTemplates(elem,
context.getContextNode(),
context.getMode(), formatter);
+
+ endRedirection(transf); // for tracing only
if(!inTable)
{
@@ -409,8 +413,8 @@
try
{
SerializationHandler flistener =
- transformer.createSerializationHandler(new StreamResult(ostream),
- format);
+ createSerializationHandler(transformer, ostream, file, format);
+
try
{
flistener.startDocument();
@@ -431,5 +435,54 @@
throw new javax.xml.transform.TransformerException(te);
}
+ }
+
+ /**
+ * A class that extends this class can over-ride this public method and
recieve
+ * a callback that redirection is about to start
+ * @param transf The transformer.
+ * @param formatter The handler that receives the redirected output
+ */
+ public void startRedirection(TransformerImpl transf, ContentHandler
formatter)
+ {
+ // A class that extends this class could provide a method body
+ }
+
+ /**
+ * A class that extends this class can over-ride this public method and
receive
+ * a callback that redirection to the ContentHandler specified in the
startRedirection()
+ * call has ended
+ * @param transf The transformer.
+ */
+ public void endRedirection(TransformerImpl transf)
+ {
+ // A class that extends this class could provide a method body
+ }
+
+ /**
+ * A class that extends this one could over-ride this public method and
receive
+ * a callback for the creation of the serializer used in the redirection.
+ * @param transformer The transformer
+ * @param ostream The output stream that the serializer wraps
+ * @param file The file associated with the ostream
+ * @param format The format parameter used to create the serializer
+ * @return the serializer that the redirection will go to.
+ *
+ * @throws java.io.IOException
+ * @throws TransformerException
+ */
+ public SerializationHandler createSerializationHandler(
+ TransformerImpl transformer,
+ FileOutputStream ostream,
+ File file,
+ OutputProperties format)
+ throws java.io.IOException, TransformerException
+ {
+
+ SerializationHandler serializer =
+ transformer.createSerializationHandler(
+ new StreamResult(ostream),
+ format);
+ return serializer;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]