Subject: Re: [xsl] Using a TransformerHandler strips comments but a Transformer keeps them From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Wed, 13 Feb 2008 11:23:07 +0000 |
On 13/02/2008, David McKain <dmckain@xxxxxxxxxxx> wrote: > Andrew Welch wrote: > > > Does anyone know why a transform using a TransformerHandler strips > > comments but the "stardard" Tranformer keeps them. > > > > [snipped] > > XMLReader xmlReader = XMLReaderFactory.createXMLReader(); > > xmlReader.setContentHandler(handler); > > xmlReader.parse(sourceXML.toURI().toString()); > > Hi Andrew, > > You need to tell your XMLReader to forward lexical events (e.g. > comments) to the TransformerHandler as well. In what you have above, you > have only asked it to forward basic ContentHandler-type SAX events onwards. > > Add the following after your setContentHandler() line: > > xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", > hander); > > and you should find your comments reappearing. Ahh great thanks - I did scan the features and properties lists but lexical-handler didn't jump out at me... cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using a TransformerHandle, David McKain | Thread | RE: [xsl] Using a TransformerHandle, Michael Kay |
RE: [xsl] Using a TransformerHandle, Michael Kay | Date | [xsl] fairly complex xslt not givin, David at roamware |
Month |