cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andr...@apache.org>
Subject Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments
Date Fri, 27 Feb 2009 13:18:12 GMT
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);
}

HTH,

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


Mime
View raw message