Listing 9. Chaining the XCBL Writer to the Order Processor /** * This method takes an InputSource that represents an order in * XCBL 3.5 format and converts it to an Order object and also * creates an XCBL 3.5 OrderResponse document to be returned * to the buyer * * @param argIn the order in XCBL 3.5 format * @param argWriter the writer to which to write the OrderResponse * document * @exception SAXException, IOException */ public Order processXCBL35Order(InputSource argIn, Writer argWriter) throws SAXException, IOException { m_parserManager = new SAXAdapter(); m_writerManager = new SAXAdapter(m_parserManager); m_writerHandler = new XCBLResponseWriter(m_writerManager); m_writerManager.registerDefaultHandler(m_writerHandler); m_writerHandler.setWriter(argWriter); // always call parse() on the last pipeline element Map map = new HashMap(); m_parserManager.setMap(map); m_writerManager.parse(argIn); Order order = (Order) map.get(OrderConstants.ORDER_TAG); map.clear(); return order; }