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:26:54 GMT
Andreas Hartmann schrieb:
> 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. 

Maybe it makes sense to set the lexical handler, if possible?

     public void toSAX(ContentHandler contentHandler) throws SAXException {
         final SAXParser parser = getContext().parser;
         parser.getXMLReader().setContentHandler(contentHandler);

+       if (contentHandler instanceof LexicalHandler) {
+           parser.getXMLReader().setProperty(
+             "http://xml.org/sax/properties/lexical-handler",
+             (LexicalHandler) contentHandler);
+       }

         InputSource is = new InputSource(new StringReader(data));
         try {
             parser.getXMLReader().parse(is);
         } catch (IOException e) {
             throw new SAXException(e);
         }
     }


-- Andreas




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


Mime
View raw message