cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject [c3] StAX components usage in xmap
Date Fri, 26 Aug 2011 08:54:26 GMT
Hi all,

I did not found any examples of using  StAX components in our xmap. Is
it because we did not implement setConfiguration in the XMLGenerator

I did that and it seems to work fine however if you review the code I do

    public void setConfiguration(
            final Map<String, ? extends Object> configuration) {
        URLConnection connection = null;
        try {
            URL url = (URL) configuration.get("source");
            connection = url.openConnection();
            this.reader =
        } catch (Exception e) {
            throw new SetupException("Error during setup an
XMLEventReader on the inputStream", e);
        We cannot close the connection otherwise the stax.serializer
will not receive an END_DOCUMENT event
        finally {
            if (connection != null) {

The thing I do not like is that we cannot close the connection in the
finally since  otherwise the stax.serializer will not receive an
END_DOCUMENT event. Is there another way to get the inputStream and put
it in the StAX pipe?


Thorsten Scherler <>
codeBusters S.L. - web based systems
<consulting, training and solutions>

View raw message