[jira] Assigned: (COCOON3-28) [PATCH] documentation for stax-pipelines

2009-02-27 Thread Reinhard Poetz (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON3-28?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Reinhard Poetz reassigned COCOON3-28:
-

Assignee: Reinhard Poetz  (was: Cocoon Developers Team)

 [PATCH] documentation for stax-pipelines
 

 Key: COCOON3-28
 URL: https://issues.apache.org/jira/browse/COCOON3-28
 Project: Cocoon 3
  Issue Type: Improvement
  Components: cocoon-docs, cocoon-stax
Affects Versions: 3.0.0-alpha-2
Reporter: Andreas Pieber
Assignee: Reinhard Poetz
 Fix For: 3.0.0-alpha-2

 Attachments: stax-pipelines-docs.patch


 This patch should provide a first view on the documentation for the 
 cocoon-stax components/pipeline. Most things are finished so far, and we 
 think that this part could make its way into the code-base. Whats still not 
 perfekt is the description of the transformers, but we're working on them. 
 Nevertheless by releasing it we hope to get feedback and corrections ;)

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



[jira] Assigned: (COCOON3-27) [PATCH] Add Java5 support

2009-02-27 Thread Reinhard Poetz (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON3-27?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Reinhard Poetz reassigned COCOON3-27:
-

Assignee: Reinhard Poetz  (was: Cocoon Developers Team)

 [PATCH] Add Java5 support
 -

 Key: COCOON3-27
 URL: https://issues.apache.org/jira/browse/COCOON3-27
 Project: Cocoon 3
  Issue Type: Improvement
  Components: cocoon-stax
Affects Versions: 3.0.0-alpha-2
Reporter: Andreas Pieber
Assignee: Reinhard Poetz
 Fix For: 3.0.0-alpha-2

 Attachments: stax-jdk1.5.patch


 Kilian pushed me at the fact that we could very easily support java5 in the 
 StAX component. The only thing which have to be done for this is to add an 
 optional dependency to the woodstox StAX implementation and remove all the 
 @Override-Annotations from the code. So in a java6 environment the woodstox 
 reference is not required and the module will work with the default 
 implementation. For java5 the additional dependency is required. 

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



[jira] Closed: (COCOON3-27) [PATCH] Add Java5 support

2009-02-27 Thread Reinhard Poetz (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON3-27?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Reinhard Poetz closed COCOON3-27.
-

Resolution: Fixed

Patch applied - thanks Kilian and Andreas.

 [PATCH] Add Java5 support
 -

 Key: COCOON3-27
 URL: https://issues.apache.org/jira/browse/COCOON3-27
 Project: Cocoon 3
  Issue Type: Improvement
  Components: cocoon-stax
Affects Versions: 3.0.0-alpha-2
Reporter: Andreas Pieber
Assignee: Reinhard Poetz
 Fix For: 3.0.0-alpha-2

 Attachments: stax-jdk1.5.patch


 Kilian pushed me at the fact that we could very easily support java5 in the 
 StAX component. The only thing which have to be done for this is to add an 
 optional dependency to the woodstox StAX implementation and remove all the 
 @Override-Annotations from the code. So in a java6 environment the woodstox 
 reference is not required and the module will work with the default 
 implementation. For java5 the additional dependency is required. 

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



IncludeXMLConsumer with RedundantNamespacesFilter does not output comments

2009-02-27 Thread Thorsten Scherler
Hi all, 

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=hview=markup
-- 
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)






[jira] Created: (COCOON-2253) StringXMLizable in combination with IncludeXMLConsumer does not handle xml-comments

2009-02-27 Thread Thorsten Scherler (JIRA)
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
Reporter: Thorsten Scherler
Assignee: Cocoon Developers Team


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=hview=markup
 

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



[jira] Updated: (COCOON-2253) StringXMLizable in combination with IncludeXMLConsumer does not handle xml-comments

2009-02-27 Thread Thorsten Scherler (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Scherler updated COCOON-2253:
--

Attachment: TestComment.java

Class that will show the error.

Save it where you have your java classes in the directory 
org/apache/forrest/dispatcher/transformation.

Please add to your sitemap:
{{{
map:transformers
  map:transformer name=testComment
 src=org.apache.forrest.dispatcher.transformation.TestComment/
/map:transformers
}}}

and later a debug match like:
{{{
map:match pattern=foo.bar
  map:generate src=SomeXmlDoesNotMatterWhich.xml/
   map:transform type=testComment/
   map:serialize type=xml/
/map:match
}}}

You will see 
{{{
?xml version=1.0 encoding=ISO-8859-1?
body
  comment/
  textxxx/text
/body
}}}

BUT the entrance had been:
{{{
bodycomment!--test--/commenttextxxx/text/body
}}}

 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
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=hview=markup
  

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



[jira] Issue Comment Edited: (COCOON-2253) StringXMLizable in combination with IncludeXMLConsumer does not handle xml-comments

2009-02-27 Thread Thorsten Scherler (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12677346#action_12677346
 ] 

thorsten edited comment on COCOON-2253 at 2/27/09 4:36 AM:


Class that will show the error.

Save it where you have your java classes in the directory 
org/apache/forrest/dispatcher/transformation.

Please add to your sitemap:
map:transformers
  map:transformer name=testComment
 src=org.apache.forrest.dispatcher.transformation.TestComment/
/map:transformers

and later a debug match like:
map:match pattern=foo.bar
  map:generate src=SomeXmlDoesNotMatterWhich.xml/
   map:transform type=testComment/
   map:serialize type=xml/
/map:match

You will see 
?xml version=1.0 encoding=ISO-8859-1?
body
  comment/
  textxxx/text
/body

BUT the entrance had been:
bodycomment!--test--/commenttextxxx/text/body


  was (Author: thorsten):
Class that will show the error.

Save it where you have your java classes in the directory 
org/apache/forrest/dispatcher/transformation.

Please add to your sitemap:
{{{
map:transformers
  map:transformer name=testComment
 src=org.apache.forrest.dispatcher.transformation.TestComment/
/map:transformers
}}}

and later a debug match like:
{{{
map:match pattern=foo.bar
  map:generate src=SomeXmlDoesNotMatterWhich.xml/
   map:transform type=testComment/
   map:serialize type=xml/
/map:match
}}}

You will see 
{{{
?xml version=1.0 encoding=ISO-8859-1?
body
  comment/
  textxxx/text
/body
}}}

BUT the entrance had been:
{{{
bodycomment!--test--/commenttextxxx/text/body
}}}
  
 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
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=hview=markup
  

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



[jira] Updated: (COCOON-2253) StringXMLizable in combination with IncludeXMLConsumer does not handle xml-comments

2009-02-27 Thread Thorsten Scherler (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Scherler updated COCOON-2253:
--

Affects Version/s: 2.2

 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.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=hview=markup
  

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



[jira] Commented: (COCOON-2253) StringXMLizable in combination with IncludeXMLConsumer does not handle xml-comments

2009-02-27 Thread Thorsten Scherler (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12677352#action_12677352
 ] 

Thorsten Scherler commented on COCOON-2253:
---

This happens with jdk 1.5 and 1.6. 

 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.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=hview=markup
  

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



[jira] Updated: (COCOON-2253) StringXMLizable in combination with IncludeXMLConsumer does not handle xml-comments

2009-02-27 Thread Thorsten Scherler (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Scherler updated COCOON-2253:
--

Affects Version/s: 2.1.12-dev (Current SVN)

 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=hview=markup
  

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



Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments

2009-02-27 Thread Thorsten Scherler
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.

 
 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=hview=markup
-- 
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)






Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments

2009-02-27 Thread Andreas Hartmann

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



Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments

2009-02-27 Thread Andreas Hartmann

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. 
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);


BTW, since IncludeXMLConsumer implements LexicalHandler, you can just 
attach that one:


IncludeXMLConsumer consumer = new IncludeXMLConsumer(super.xmlConsumer);

parser.getXMLReader().setContentHandler(consumer);

parser.getXMLReader().setProperty(
  http://xml.org/sax/properties/lexical-handler;,
  consumer);


-- Andreas




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



Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments

2009-02-27 Thread Andreas Hartmann

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



Re: IncludeXMLConsumer with RedundantNamespacesFilter does not output comments

2009-02-27 Thread Thorsten Scherler
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)