Hello,

I am not sure if Jelly should be discussed here, so tell me if I
should post that message to some another mail list.

I tried to use saxon with Jelly and run into the problem: saxon throws
NullPointerException when tries to use systemId property of
StreamSource object.

After some investigations I've found that StreamSource created by
Jelly's xml tag library URI resolver in the following manner:

public Source resolve(String href, String base) {
...
return new StreamSource(context.getResourceAsStream(href));
}

As far as I know TRaX API requires to call setSystemId()
method if StreamSource(InputStream is) constructor used. Here is the
corresponding javadoc comment:

...
* <p>If this constructor is used to process a stylesheet, normally
* setSystemId should also be called, so that relative URI references
* can be resolved.</p>
*
* @param inputStream A valid InputStream reference to an XML stream.
*/
public StreamSource(InputStream inputStream)


And just because that was not done saxon throws an Exception. I
believe that if the following code will be used instead of
return new StreamSource(context.getResourceAsStream(href))

the problem will be solved:

URL systemId = null;
InputStream is = null;
try
{
   systemId = context.getResource(href);
   is = systemId.openStream();
}
catch (Exception e)
{
      throw new TransformerException(e);
}

return new StreamSource(is, systemId.toString());

P.S:
I've not yet subscribed to this mailing list, so please send answer to
my email too.

-- 
Best regards,
 Pavel                          mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to