[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Andrew Welch wrote:
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:
and you should find your comments reappearing.
There's more info in the JavaDoc for org.xml.sax.ext.LexicalHandler
Re: [xsl] Using a TransformerHandler strips comments but a Transformer keeps them
Subject: Re: [xsl] Using a TransformerHandler strips comments but a Transformer keeps them From: David McKain <dmckain@xxxxxxxxxxx> Date: Wed, 13 Feb 2008 11:13:18 +0000 |
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.
There's more info in the JavaDoc for org.xml.sax.ext.LexicalHandler
Cheers, Dave.
-- David McKain http://www.ph.ed.ac.uk/~dmckain/ School of Physics e-Learning Group http://www.ph.ed.ac.uk/elearning/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using a TransformerHandler st, Andrew Welch | Thread | Re: [xsl] Using a TransformerHandle, Andrew Welch |
[xsl] Using a TransformerHandler st, Andrew Welch | Date | RE: [xsl] Using a TransformerHandle, Michael Kay |
Month |