You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by re...@cnedi06.cnafmail.fr on 2000/09/27 11:26:55 UTC

html output on OS390

hello,
I have a problem to transform xml into html. when I specify an output
methode with html like argument in the xsl i have a null pointer exception,
what can I do??

my code:
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(("TestBailleurASCII.xml")), new
XSLTInputSource(new java.io.FileReader ("DemoHTML.xsl")), new
XSLTResultTarget(new java.io.FileWriter ("res.html")));

exception value:
 java.lang.NullPointerException at
org.apache.xalan.xpath.xml.FormatterToXML.init(FormatterToXML.java:40 at
org.apache.xalan.xslt.StylesheetRoot.makeSAXSerializer(StylesheetRoot at
org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:340) at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:583) at
SimpleTransform.main(SimpleTransform.java:71)


Re: html output on OS390

Posted by Gary L Peskin <ga...@firstech.com>.
Gary L Peskin wrote:
> 2.  If I make the result target any type of stream, I get an empty
> file!  I tried this on my PC as well and I also get an empty file there
> so there seems to be something wrong or something I don't understand
> when making the Result Target a stream.  However, in this case, you seem
> to blow up with a null pointer exception.

Remy --

I've solved my problem.  I'm now getting EBCDIC XML output on OS/390. 
The problem was in my understanding of how Xalan works.  Xalan does not
close the Writer.  Thus, everything was working okay but I was never
getting any output because I was failing to close the writer.  I've
changed my program to read:

java.io.Writer myWriter = new java.io.FileWriter("res.html");
SLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(("TestBailleurASCII.xml")), new
XSLTInputSource(new java.io.FileReader ("DemoHTML.xsl")), new
XSLTResultTarget(myWriter));
myWriter.close();

and everything is working fine.

Of course, this doesn't help you.  I think I misspoke earlier when I
thought you were blowing up in the constructor because I saw the .init
method.  However, there is an init method and this is where I think
you're blowing up.

Can you run this on the mainframe in such a way that you can get the
actual line numbers in the traceback?

The only difference between our two setups is possibly the Xalan version
and the stylesheets used.  Can you send me TestBailleurASCII.xml and
DemoHTML.xsl so that I can test with those?  It would probably be best
if you zipped them up so that the EBCDIC doesn't get munged in the
transmission.

Awaiting your response,
Gary

Re: html output on OS390

Posted by Gary L Peskin <ga...@firstech.com>.
remy.lansac@cnedi06.cnafmail.fr wrote:
> >
> > hello,
> > I have a problem to transform xml into html. when I specify an output
> > methode with html like argument in the xsl i have a null pointer exception,
> > what can I do??
> >
> > my code:
> > XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
> > processor.process(new XSLTInputSource(("TestBailleurASCII.xml")), new
> > XSLTInputSource(new java.io.FileReader ("DemoHTML.xsl")), new
> > XSLTResultTarget(new java.io.FileWriter ("res.html")));
> >
> > exception value:
> >  java.lang.NullPointerException at
> > org.apache.xalan.xpath.xml.FormatterToXML.init(FormatterToXML.java:40 at
> > org.apache.xalan.xslt.StylesheetRoot.makeSAXSerializer(StylesheetRoot at
> > org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:340) at
> > org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:583) at
> > SimpleTransform.main(SimpleTransform.java:71)

Remy -- 

Things are getting stranger!!  I'm not able to duplicate your problem
but here 
are my results.  On OS/390, I'm using an ASCII input XML file and an
EBCDIC stylesheet just like you.

1.  If I make the result target an output file (new
XSLTResultTarget("res.html")), then everything seems to work properly
and I get an ASCII output file in res.html.

2.  If I make the result target any type of stream, I get an empty
file!  I tried this on my PC as well and I also get an empty file there
so there seems to be something wrong or something I don't understand
when making the Result Target a stream.  However, in this case, you seem
to blow up with a null pointer exception.

What version of Xalan are you using?  I'm using 1.2.D01.  Hopefully,
you're on a different version.

I've added this to my list of things to look into.  I'll keep the list
advised.

Gary

Re: html output on OS390

Posted by Gary L Peskin <ga...@firstech.com>.
remy.lansac@cnedi06.cnafmail.fr wrote:
> 
> hello,
> I have a problem to transform xml into html. when I specify an output
> methode with html like argument in the xsl i have a null pointer exception,
> what can I do??
> 
> my code:
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
> processor.process(new XSLTInputSource(("TestBailleurASCII.xml")), new
> XSLTInputSource(new java.io.FileReader ("DemoHTML.xsl")), new
> XSLTResultTarget(new java.io.FileWriter ("res.html")));
> 
> exception value:
>  java.lang.NullPointerException at
> org.apache.xalan.xpath.xml.FormatterToXML.init(FormatterToXML.java:40 at
> org.apache.xalan.xslt.StylesheetRoot.makeSAXSerializer(StylesheetRoot at
> org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:340) at
> org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:583) at
> SimpleTransform.main(SimpleTransform.java:71)

This is a tough problem for me given the information that you've
provided.  The line number in FormatterToXML.java where the exception
occurred is cut off in your stack trace.  However, 
I'm really confused because makeSAXSerializer() just calls new
FormatterToXML() with no arguments.  All that does is call
initEncodings() which is a static method.  There is no opportunity for a
NullPointerException in the FormatterToXML constructor itself.  Maybe
initEncodings() is not showing up in the stack trace on OS/390 because
it's a static method.

If that's the case, then there is a problem with the encodings.  This is
not unlikely because OS/390 tends to be just a little different.

Does this work if your use an XSLTResultTarget of System.out?

I'm going to try to load Xalan onto an OS/390 box in the next few days
and try to reproduce this problem.

Gary