cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thorsten.scherler....@juntadeandalucia.es>
Subject Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments
Date Fri, 27 Feb 2009 13:56:49 GMT
On Fri, 2009-02-27 at 14:18 +0100, Andreas Hartmann wrote:
> Hi Thorsten,
> 
> Thorsten Scherler schrieb:
> > On Fri, 2009-02-27 at 10:09 +0100, Thorsten Scherler wrote:
> >> Hi all, 
> >>
> >> I encountered a very weird problem that happened suddenly. 
> >> ...
> >> You can test it by doing 
> > ...
> > 
> > I opened an issue https://issues.apache.org/jira/browse/COCOON-2253
> > which contains a test class and instructions to use them.
> > 
> >> I see (while debugging) in the IncludeXMLConsumer that comment(...) is
> >> not being called but does it e.g. for startElements.
> >>
> >> Anybody has a clue what is going on?
> > 
> > I welcome ANY suggestions.
> 
> StringXMLizable.toSAX() sets only the content handler of the SAX parser. 
> I think this approach is not sufficent to include comments. You'd have 
> to attach a LexialHandler as well:
> 
> final LexicalHandler lexicalHandler = …; (receives comment events);
> 
> final SAXParser parser = …;
> parser.getXMLReader().setContentHandler(contentHandler);
> parser.getXMLReader().setProperty(
>    "http://xml.org/sax/properties/lexical-handler",
>    lexicalHandler);
> InputSource is = new InputSource(new StringReader(data));
> try {
>      parser.getXMLReader().parse(is);
> } catch (IOException e) {
>      throw new SAXException(e);
> }

Nice! Thx Andreas, using a parser directly in my code is working fine. I
agree that the StringXMLizable should as well set the lexical handler if
possible. If not we should at least warn in he javadocs.

Thanks again Andreas. :)

I will come back to this issue on monday.

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





Mime
View raw message