You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Decarli, Jim" <Ji...@fishersci.com> on 2001/06/21 20:59:24 UTC
tFactory.newInstance
Hi,
I'm trying to run the following code in a Java servlet:
try {
InputStream bais = new ByteArrayInputStream(in_XML.getBytes());
OutputStream baos = new ByteArrayOutputStream();
TransformerFactory tFactory = TransformerFactory.newInstance();
// Use the TransformerFactory to instantiate a Transformer that
will work with the stylesheet you specify.
// This method call also processes the stylesheet into a
compiled Templates object.
** Transformer transformer = tFactory.newTransformer(new
StreamSource("http://mydomain.com/xml/stylesheet/stylesheetname.html.xsl"));
// Use the Transformer to apply the associated Templates object
to an XML document
transformer.transform(new StreamSource(bais), new
StreamResult(baos));
}
catch(Exception e) {
Debug.println("Exception XSLT Transformation! " +
e.toString(),1,DebugLogFilenames.XML_LOG);
}
The line denoted with ** is where it hangs. It does not throw any
exceptions. This code is being run on a Sun Solaris machine. The same code
when run on NT webserver runs fine as long as the Stream Source is changed
to a file location such as "C:\xml\stylesheet\stylesheetname.html.xsl". I
have put "http://mydomain.com/xml/stylesheet/stylesheetname.html.xsl" in my
browser and it displays the style sheet fine so I think that it is resolving
the URL alright. I would think that an exception would be thrown and caught
if this was a problem but nothing ever makes it to the exception log. Any
ideas?
Re: tFactory.newInstance
Posted by jason heddings <Ja...@Sun.COM>.
Jim-
Are you using a proxy server to access the internet?
"Decarli, Jim" wrote:
>
> Hi,
>
> I'm trying to run the following code in a Java servlet:
>
> try {
> InputStream bais = new ByteArrayInputStream(in_XML.getBytes());
> OutputStream baos = new ByteArrayOutputStream();
>
> TransformerFactory tFactory = TransformerFactory.newInstance();
>
> // Use the TransformerFactory to instantiate a Transformer that
> will work with the stylesheet you specify.
> // This method call also processes the stylesheet into a
> compiled Templates object.
> ** Transformer transformer = tFactory.newTransformer(new
> StreamSource("http://mydomain.com/xml/stylesheet/stylesheetname.html.xsl"));
>
> // Use the Transformer to apply the associated Templates object
> to an XML document
> transformer.transform(new StreamSource(bais), new
> StreamResult(baos));
> }
> catch(Exception e) {
> Debug.println("Exception XSLT Transformation! " +
> e.toString(),1,DebugLogFilenames.XML_LOG);
>
> }
>
> The line denoted with ** is where it hangs. It does not throw any
> exceptions. This code is being run on a Sun Solaris machine. The same code
> when run on NT webserver runs fine as long as the Stream Source is changed
> to a file location such as "C:\xml\stylesheet\stylesheetname.html.xsl". I
> have put "http://mydomain.com/xml/stylesheet/stylesheetname.html.xsl" in my
> browser and it displays the style sheet fine so I think that it is resolving
> the URL alright. I would think that an exception would be thrown and caught
> if this was a problem but nothing ever makes it to the exception log. Any
> ideas?
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\\\|/// Jason Heddings ((
\\ ~ ~ // 303.272.5166 (x75166) C|~~|
(/ @ @ /) Jason.Heddings@Sun.COM `__'
~~oOOo~(_)~oOOo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~