The template parser is nominally an xml parser. But the implementation
is much more complicated than that as it does not expect all content
in the file to be strictly well formed.
As far a Tapestry is concerned content that does not contain a
Tapestry component reference or directive is just text and collected,
not parsed.
Seems like a case has been missed with respect to CDATA.
If you would like to see this case handled properly I would suggest
adding a bug into Jira.
Making requests for changes on the list often fall between the cracks.
Geoff
On 8/13/05, Paul Cantrell <[EMAIL PROTECTED]> wrote:
> Thanks for the clever ideas, but I'm not really looking for a
> workaround -- I have one in the <!-- comment --> approach.
>
> I'm wondering why the Tapestry template parser, which theoretically
> handles XML, can't parse CDATA.
>
>
> On Aug 13, 2005, at 5:43 PM, Patrick Casey wrote:
>
> >
> > I don't suppose you could just double-escape and sidestep the
> > problem e.g.
> >
> > if (foo %gt bar) alert('hello world');?
> >
> > Alternately you could do what I've always done and put all the
> > scripts in external script files and just put the function calls in
> > the
> > .html file. Here, for example, is the script that actually gets
> > called from
> > the template snippet below.
> >
> > The definition:
> >
> > <context-asset name="question_js" path="/script/SurveyQuestion.js"/>
> > <component id="questionScript" type="Any">
> > <static-binding name="element" value="script"/>
> > <binding name="src" expression="assets.question_js"/>
> > </component>
> >
> > The .html
> > <script jwcid="questionScript" language="JavaScript"
> > type="text/javascript"/>
> >
> > The .js file
> >
> > function changeType() {
> > var choice = getElementById('choice');
> > var number = getElementById('number');
> > var text = getElementById('text');
> > var number_span = getElementById('number_span');
> > var spanstart = getElementById('spanstartrow');
> > var spanend = getElementById('spanendrow');
> > var spanstarttag = getElementById('spanstarttagrow');
> > var spanendtag = getElementById('spanendtagrow');
> > var optionlist = getElementById('optionlist');
> > // we hide everything and unhide as needed
> > spanstart.style.display='none';
> > spanend.style.display='none';
> > spanstarttag.style.display='none';
> > spanendtag.style.display='none';
> > optionlist.style.display='none';
> > if (choice != null && choice.checked) {
> > optionlist.style.display='';
> > }
> > if (number != null && number.checked) {
> > }
> >
> > if (text != null && text.checked) {
> > }
> >
> > if (number_span != null && number_span.checked) {
> > spanstart.style.display='';
> > spanend.style.display='';
> > spanstarttag.style.display='';
> > spanendtag.style.display='';
> >
> > }
> > }
> >
> >
> >
> >> -----Original Message-----
> >> From: Paul Cantrell [mailto:[EMAIL PROTECTED]
> >> Sent: Saturday, August 13, 2005 4:36 PM
> >> To: Tapestry users
> >> Subject: Re: CDATA in Tapestry templates?
> >>
> >> Yes: anytime you use, say, the < operator, Tapestry tries to read it
> >> as a tag.
> >>
> >> On Aug 13, 2005, at 5:29 PM, Patrick Casey wrote:
> >>
> >>
> >>>
> >>> Is there some special reason you need to CDATA escape it?
> >>>
> >>> I've got a couple of pages that embed regular old javascript
> >>> without
> >>> any problems e.g.
> >>>
> >>>
> >>> <input type="submit" jwcid="@Submit"
> >>> listener="ognl:listeners.questionTest"
> >>> label="Test This Question" />
> >>> <!-- initialize the data -->
> >>> <script>changeType()</script>
> >>>
> >>> --- Pat
> >>>
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Paul Cantrell [mailto:[EMAIL PROTECTED]
> >>>> Sent: Saturday, August 13, 2005 4:27 PM
> >>>> To: Tapestry users
> >>>> Subject: CDATA in Tapestry templates?
> >>>>
> >>>> Tapestry doesn't seem to understand CDATA-escaped Javascript. I get
> >>>> errors like this:
> >>>>
> >>>> Tag <![CDATA[> on line 183 contains more than one 'noDrag'
> >>>> attribute.
> >>>>
> >>>> ...when I have something like this in the page:
> >>>>
> >>>> <script type="text/javascript"> //<![CDATA[
> >>>>
> >>>> dragCat = null;
> >>>> dropCat = null;
> >>>> noDrag = false;
> >>>> ...
> >>>>
> >>>> Seems to work if I use <!-- commends --> instead of CDATA, though
> >>>> this prevents me from using the decrement operator (--) in my
> >>>> Javascript.
> >>>>
> >>>> Shouldn't the template parser respect CDATA? Tapestry templates are
> >>>> XML, right?
> >>>>
> >>>> Cheers,
> >>>>
> >>>> Paul
> >>>>
> >>>> _________________________________________________________________
> >>>>
> >>>> "I never let my schooling get in the way of my education."
> >>>> -- Mark Twain
> >>>>
> >>>>
> >>>>
> >>>> -------------------------------------------------------------------
> >>>> --
> >>>> To unsubscribe, e-mail: tapestry-user-
> >>>> [EMAIL PROTECTED]
> >>>> For additional commands, e-mail: tapestry-user-
> >>>> [EMAIL PROTECTED]
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>> --------------------------------------------------------------------
> >>> -
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: tapestry-user-
> >>> [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>>
> >>
> >> _________________________________________________________________
> >>
> >> "I never let my schooling get in the way of my education."
> >> -- Mark Twain
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: tapestry-user-
> >> [EMAIL PROTECTED]
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> _________________________________________________________________
>
> "The pursuit of truth and beauty is a sphere of activity in which
> we are permitted to remain children all our lives."
> -- Albert Einstein
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
The Spindle guy. http://spindle.sf.net
Get help with Spindle:
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates: http://spindle.sf.net/updates
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]