xml-xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cory Isaacson \(Compuflex\)" <cisaac...@compuflex.com>
Subject Fw: Stylesheet serialization problem
Date Thu, 03 Aug 2000 23:02:10 GMT
This is a bug, as there are one or more objects which are not Serializable.
However, the solution recommended to me (which works fine) is just to store
a re-usable StyleSheetRoot in memory. Its very fast at processing after
that.

Cory
----- Original Message -----
From: "Baback Elmieh" <belmieh@ccs.neu.edu>
To: <xalan-dev@xml.apache.org>
Sent: Thursday, August 03, 2000 6:14 PM
Subject: Stylesheet serialization problem


> Hi,
>
> I'm having a problem with the org.apache.xalan.xslt.StylesheetRoot
> class, I noticed that it was a Serializable class so I tried to write a
> simple program to write a compiled stylesheet to file and I seem to be
> bumping into a NotSerializableException. Here is my stack trace:
>
> org.apache.xalan.xpath.xml.StringToStringTable
>   java.io.NotSerializableException:
>      org.apache.xalan.xpath.xml.StringToStringTable
>   void java.io.ObjectOutputStream.writeObject(java.lang.Object)
>   void com.winwin.xmlsystem.testSimpleObj.main(java.lang.String[])
>
> My code that produces this bug is as follows (I have made the xsl
> inline just in case it's form is the problem, it is pretty much the
> simplest valid XSL file I could think of)
>
> import org.apache.xalan.xslt.*;
> import java.io.*;
>
> class testSimpleObj
> {
>   public static void main (String[] args)
>   {
>     StylesheetRoot compiledXSL = null;
>
>     // some simple xsl
>     String xslText = "<?xml version='1.0' encoding='iso-8859-1'?>" +
> "<xsl:stylesheet xmlns:xsl='http://www.w3.org/XSL/Transform/1.0'>" +
> "<xsl:template match='/'>" +
> "<xsl:value-of select='.' />" +
> "</xsl:template>" +
> "</xsl:stylesheet>";
>
>     try {
>       // compile the XSL file as per the Getting Started instructions
>       // on Xalan website:
>
>       XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
>       InputStream xslis= new ByteArrayInputStream(xslText.getBytes());
>       XSLTInputSource xslSource = new XSLTInputSource(xslis);
>       compiledXSL = processor.processStylesheet(xslSource);
>     }
>     catch(org.xml.sax.SAXException e)
>     {
>       System.err.println(e.getMessage());
>       e.printStackTrace();
>     }
>     if (compiledXSL != null)
>     {
>       // try to write it if the parse went okay:
>       try {
>         FileOutputStream os = new FileOutputStream("style.obj");
>         ObjectOutputStream bOut = new ObjectOutputStream(os);
>         bOut.writeObject(compiledXSL);
>       }
>       catch (IOException e)
>       {
>         System.err.println(e.getMessage());
>         e.printStackTrace();
>       }
>     }
>   }
> }
>
> Could anyone let me know if this is a reproducable bug or if I'm just
> hitting something weird?
>
> Thanks,
> - Baback
>


Mime
View raw message