cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <scher...@gmail.com>
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
yet?

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

@Override
    public void setConfiguration(
            final Map<String, ? extends Object> configuration) {
        URLConnection connection = null;
        try {
            URL url = (URL) configuration.get("source");
            connection = url.openConnection();
            this.reader =
XMLInputFactory.newInstance().createXMLEventReader(connection.getInputStream());
        } 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) {
                URLConnectionUtils.closeQuietly(connection);
            }
        }*/
    }

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?

salu2

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
codeBusters S.L. - web based systems
<consulting, training and solutions>
http://www.codebusters.es/



Mime
View raw message