[ 
https://issues.apache.org/jira/browse/COCOON-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677930#action_12677930
 ] 

Thorsten Scherler commented on COCOON-2253:
-------------------------------------------

On Fri, 2009-02-27 at 14:26 +0100, Andreas Hartmann wrote:
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);
>          }
>      }

> StringXMLizable in combination with IncludeXMLConsumer does not handle 
> xml-comments
> -----------------------------------------------------------------------------------
>
>                 Key: COCOON-2253
>                 URL: https://issues.apache.org/jira/browse/COCOON-2253
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.1.12-dev (Current SVN), 2.2
>            Reporter: Thorsten Scherler
>            Assignee: Cocoon Developers Team
>         Attachments: TestComment.java
>
>
> http://markmail.org/thread/h5jfhzmv7su2osob
> I encountered a very weird problem that happened suddenly.
> I am using the dispatcherTransformer [1] and in the method 
> structurerProcessingEnd() I am doing: ... StringXMLizable xml = new 
> StringXMLizable(out.toString()); xml.toSAX(new 
> IncludeXMLConsumer(super.xmlConsumer)); ...
> I as well tried XMLUtils.valueOf(new IncludeXMLConsumer(super.xmlConsumer), 
> xml);
> but after this stage the comments disappear.
> You can test it by doing StringXMLizable xml = new 
> StringXMLizable("<body><!--test--></body>"); xml.toSAX(new 
> IncludeXMLConsumer(super.xmlConsumer)); in a clean transformer and you get 
> "<body> </body>".
> First I though it is the RedundantNamespacesFilter which I used as consumer 
> but changing this did not work.
> 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?
> salu2
> [1] 
> http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?diff_format=h&view=markup
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to