xml-xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baback Elmieh <belm...@ccs.neu.edu>
Subject Stylesheet serialization problem
Date Thu, 03 Aug 2000 22:14:58 GMT

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:

  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>" +

    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)
    if (compiledXSL != null)
      // try to write it if the parse went okay:
      try {
        FileOutputStream os = new FileOutputStream("style.obj");
        ObjectOutputStream bOut = new ObjectOutputStream(os);
      catch (IOException e)

Could anyone let me know if this is a reproducable bug or if I'm just 
hitting something weird?

- Baback

View raw message