You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Guillaume Lederrey <Ge...@ledcom.ch> on 2005/03/21 18:00:57 UTC
MalformedUrlException
Hello !
I have a problem that is probably fairly easy and well known, but I have not
been able to handle it alone ... Google shows a lot of similar stuff, but
nothing I could understand enough.
I try to apply a XSLT to an XML document in a servlet. Both the XSLT and the
document are fairly easy and work well inside <OxygenXML/>.
When running my servlet, I have the following error in my logs :
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.Trans
formerConfigurationException: javax.xml.transform.TransformerException:
java.net
.MalformedURLException
at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(Tran
sformerFactoryImpl.java:805)
at ch.tecost.siems.ds.GetXMLLanguage.doServlet(GetXMLLanguage.java:59)
The code producing this is the following :
protected void doServlet(HttpServletRequest request,
HttpServletResponse response, XMLSerializer serializer)
throws SiemsException {
if (validate(request, response, serializer, VALIDATION)) {
try {
Source src = new StreamSource(this.getClass().getClassLoader()
.getResourceAsStream(LANGUAGE_FILE));
Source xslt = new StreamSource(this.getClass().getClassLoader()
.getResourceAsStream(LANGUAGE_XSLT_FILE));
Result out = new StreamResult(response.getOutputStream());
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(xslt);
transformer.setParameter("lang",
request.getParameter(PARAM_LANGUAGE));
transformer.transform(src, out);
} catch [...]
the error seems to happened with "Transformer transformer =
factory.newTransformer(xslt);" but I dont directly create any URL here ...
I'm a bit lost and need some help / pointers to good documentation to get
started ...
Thanks a lot !
Guillaume
--
Guillaume Lederrey
Informaticien Développement
Tecost - Technology Consulting Studies
Fribourg (Switzerland)
http://www.tecost.ch/
Re: MalformedUrlException
Posted by Guillaume Lederrey <Ge...@ledcom.ch>.
Ok, I found the problem. Stupid problem in fact !
I'm using Maven to build the project, and I forgot to include my XSLT as
resources in the project.xml file. The file was there in the sources, but not
once deployed on the server ...
On Monday 21 March 2005 18.00, Guillaume Lederrey wrote:
> Hello !
>
> I have a problem that is probably fairly easy and well known, but I have
> not been able to handle it alone ... Google shows a lot of similar stuff,
> but nothing I could understand enough.
>
> I try to apply a XSLT to an XML document in a servlet. Both the XSLT and
> the document are fairly easy and work well inside <OxygenXML/>.
>
> When running my servlet, I have the following error in my logs :
>
> javax.xml.transform.TransformerConfigurationException:
> javax.xml.transform.Trans
> formerConfigurationException: javax.xml.transform.TransformerException:
> java.net
> .MalformedURLException
> at
> org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(Tran
> sformerFactoryImpl.java:805)
> at
> ch.tecost.siems.ds.GetXMLLanguage.doServlet(GetXMLLanguage.java:59)
>
>
> The code producing this is the following :
>
>
> protected void doServlet(HttpServletRequest request,
> HttpServletResponse response, XMLSerializer serializer)
> throws SiemsException {
> if (validate(request, response, serializer, VALIDATION)) {
> try {
> Source src = new StreamSource(this.getClass().getClassLoader()
> .getResourceAsStream(LANGUAGE_FILE));
> Source xslt = new StreamSource(this.getClass().getClassLoader()
> .getResourceAsStream(LANGUAGE_XSLT_FILE));
> Result out = new StreamResult(response.getOutputStream());
> TransformerFactory factory = TransformerFactory.newInstance();
> Transformer transformer = factory.newTransformer(xslt);
> transformer.setParameter("lang",
> request.getParameter(PARAM_LANGUAGE));
> transformer.transform(src, out);
> } catch [...]
>
> the error seems to happened with "Transformer transformer =
> factory.newTransformer(xslt);" but I dont directly create any URL here ...
>
> I'm a bit lost and need some help / pointers to good documentation to get
> started ...
>
> Thanks a lot !
>
> Guillaume
--
Guillaume Lederrey
Informaticien Développement
Tecost - Technology Consulting Studies
Fribourg (Switzerland)
http://www.tecost.ch/