xsl-list
[Top] [All Lists]

XSLT + SAX solution

2004-01-28 02:41:36
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



<Prev in Thread] Current Thread [Next in Thread>
  • XSLT + SAX solution, Razvan Veina <=