On 2/14/06, Thorsten Scherler <[EMAIL PROTECTED]> wrote:
> El mar, 14-02-2006 a las 13:50 -0500, [EMAIL PROTECTED] escribió:
> > When I used JX with Flow, I discovered (what I consider a design flaw)
> > that Cocoon's JX finishes by serializing with a transformation so all
> > angle brackets are converted to "&lt;" and "&gt;".
>
> That sounds really weird, did you report that to cocoon-dev?
>
> > This made it very
> > difficult to return XML and HTML from JX.  If it happens before
> > another transformation, the ruined tags could be ignored.
>
> In the jx-generator or transformer or both?
>
> >  Add a
> > "copy everything" match to your XSL, or add a breakpoint immmediately
> > after the JX, to test if what you expect to be XML is being processed
> > as ugly text.
>
> Actually jx should interpret the <d/> element as call for the macro not
> xsl.


Please ignore me if none of this applies to your issue.

I cannot find my notes on the bug.  I thought I filed a bugzilla for
Cocoon, but I could not find it.  I was certain I mentioned it on the
MLs, but could find nothing.  I thought it was documented on my site,
but it contains how to work around the bug, not the actual code
causing it:

===
"There is a bug in Cocoon so any tags passed to fields are trashed.
You could fix this by removing the line that serializes as XML. It was
bad programming to put it there. If the programmer wanted the &, < and
> changed to &amp;, &lt;, and &gt;, then the programmer could do it
easily. Changing them back after Cocoon destroyed them is much more
work.

Without this bug, you could pass multiple messages that each use i18n with:
form.model.messages = "<i18n:text key=\"error1\">Error 1 has
occurred.</i18n:text><br/><i18n:text key=\"error2\">Error 2 has
occurred.</i18n:text>";

With this bug, the tags will show on your form, and your visitors will
be confused."
===

I was researching why Flow was trashing the HTML created dynamically
in a JS file.  There was the above example, and also our Favorites
field where we needed to pass back a list like:
<a href="/aaa.html">AAA Link</a>
<a href="/bbb.html">BBB Link</a>
but it displayed the HTML source code rather than links.

I traced how the Form was generated through Lenya and Cocoon.  Started
with either the "form" Transformer or the Flow JS classes.  The
function that passed the values back for JX was about 20 files deep. 
I think it was in Cocoon, but it may have been an Avalon/Excalibur
class.  I think the function was less than 10 lines, and included:
"if results are serializable as XML, then send to a function that
serializes angle brackets and ampersands as character codes"
just before the return.  I remember thinking the function would ruin
all attempts to return HTML or XML.  It prevents invalid XML, but it
also severely reduced the usability.

It has been 8 months, and I cannot remember if it was specifically JX,
or was the "forms" transformer.  It has something to do with:
   var form = new Form("form.xml");
   var model = form.getModel();
   model.myfield = "<text>example</text>";
   form.showForm("myform");

I will attempt to repeat my research tonight.  It bothers me that I
cannot find my documentation about it.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to