cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal <>
Subject jx:element patch
Date Sat, 14 Jun 2008 12:16:28 GMT
I am responsible for JIRA issue 2211, including the associated patch. I 
will be honest, I didn't really understand what I did. I knew enough to 
test it and make sure it worked, but there are some points I would like 
to clarify:

Firstly, I was looking at the code for jx:attribute, in particular this:

final Attributes EMPTY_ATTRS = new AttributesImpl();
String elementName = "attribute";

TextSerializer serializer = new TextSerializer();
StringWriter writer = new StringWriter();

ContentHandlerWrapper contentHandler = new 
ContentHandlerWrapper(serializer, serializer);

contentHandler.startElement(JXTemplateGenerator.NS, elementName, 
elementName, EMPTY_ATTRS);
Invoker.execute(contentHandler, objectModel, executionContext, 
macroContext, namespaces, this.getNext(), this.getEndInstruction());
contentHandler.endElement(JXTemplateGenerator.NS, elementName, elementName);
valueStr = writer.toString(); 

Am I right in saying that the text serializer is what ensures that XML 
ouput is not serialized in the attributes? I looked at the javadoc for 
TextSerializer and found little useful information.

I noticed that there is very little validation for jx:attribute. You can 
put in any old value for an attribute name, including invalid values 
such as values with spaces and colons (':') in them. I took a very 
different approach for jx:element and tested that the prefix and name 
are valid. Is there are reason why jx:attribute does not check that the 
name is a correct name? Also, in xsp:element, apparently[1], you could 
not specify a namespace without a prefix and visa versa. I chose to 
relax this to just not allowing a prefix without a namespace. Is this right?

This is probably a very stupid question, but I know that 
|SitemapComponentTestCase.generate()produced org.w3c.dom.Document object 
and I was wondering how do I convert this into a string? If I needed to 
debug a test, I would need to install the block then produce output that 

Also, I am happy to update the documentation. Do I update the Daisy site 
or is there some other procedure I need to follow? Should I also update 
the samples?

There are a lot more questions I would like answers to, but I think that 
I would be better off investigating on my own.

Finally, I would like to thank the dev team. In the past I don't think I 
would have considered contributing code to Cocoon, not even something 
this simple. Not because I didn't want to but because the development 
environment for Cocoon was a mess. I may not agree with all  the 
decisions made regarding cocoon 2.2, but even I (someone who loathes 
using Maven) have to accept the move to Maven was a necessary change and 
has made the prospect of developing for Cocoon a little less daunting.



View raw message