[xsl] XSLT + SAX solution

Subject: [xsl] XSLT + SAX solution
From: "Razvan Veina" <veina.razvan@xxxxxxxxxxxxxxx>
Date: Wed, 28 Jan 2004 11:41:36 +0200
Hello everyone,

I finally got a solution to this one, and I'll post it here, maybe someone
will need it in the future. It is based on an example from xalan. (Sorry for
the poor formatting :)

      SAXTransformerFactory saxTFactory = ((SAXTransformerFactory)
tFactory);

      PrintWriter out = new PrintWriter ( new FileOutputStream
("result.out") );

      TransformerHandler tHandler1 = saxTFactory.newTransformerHandler(new
StreamSource(sLayoutFileName));
      TransformerHandler tHandler2 = (TransformerHandler) ( new
ExpandBarcodes ( out ) );

   XMLReader reader = XMLReaderFactory.createXMLReader();
      reader.setContentHandler(tHandler1);
      reader.setProperty("http://xml.org/sax/properties/lexical-handler";,
tHandler1);

      tHandler1.setResult(new SAXResult(tHandler2));

      reader.parse ( sXmlDataFileName );

The ExpandBarcodes class implements the ContentHandler interface and writes
to the out parameter.

Thanks everyone for your help !!!


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread