You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Paul Joseph <pj...@yahoo.com> on 2004/10/22 03:18:13 UTC

how to display html?

Hi,

i have a requirement that the user should be able to
enter a href in a text area ex:
<a
href="http://www.yahoo.com">http://www.yahoo.com</a>

Then in a different form, that is read only, this href
should display as a link that can be clicked on.

I tried to do this using the following:

<snip>

<TD>${editBean.note_with_href}</TD>

</snip>

 but what I get in the resulting table cell is the
same thing i.e. 

<a
href="http://www.yahoo.com">http://www.yahoo.com</a>

i.e. the "<" and ">" have been escape to be &lt; and
&gt;.  A bean.toString() method indicates that the
values in the bean are unescaped.  The values in the
database also appear to be unescaped.

Who is doing the escaping and how can I prevent it
from happening so that I see a clikcable link?

My sitemap is pretty basic - as follows:

<map:match pattern="display-only-pipeline">
  <map:generate type="jx" src="display_template.xml"/>
       <map:serialize type="html"/>
</map:match>

thanks!
Paul




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how to display html?

Posted by Paul Joseph <pj...@yahoo.com>.
Thanks again..(I was talking about getting the new
version of the generator..)


--- Upayavira <uv...@upaya.co.uk> wrote:

> Paul Joseph wrote:
> 
> >Thank you for the pointer.
> >
> >I think I can manage to download the
> >JXTemplateGenerator you mention...
> >  
> >
> Er, I think you're already using it. You refer to 
> ${editBean.note_with_href} which looks like a bit of
> JEXL from within a 
> jx template.
> 
> >I am not clear on the DOMFragment/DomNode bit
> however.
> >
> >I can make the bean return a DomNode or DOMFragment
> >but am not sure what it is or should look like.
> >
> >Any pointers on this would be helpful.
> >
> >The text I would like to test out is this:
> >
> >"Here is a link you can click on for more
> information:
> ><a
>
>href="http://www.yahoo.com">http://www.yahoo.com</a>"
> >
> >What would this have to look like to be treated as
> a
> >DomNode?
> >  
> >
> DOM is the Document Object Model, and it is part of
> Java's way of 
> handling XML. It is an object that represents XML as
> tree structures in 
> memory.
> 
> See, if you aren't going to find this an easy
> approach, I think you 
> might be going the wrong route. I remember
> discussions about including 
> XML in strings in JXTemplate, but cannot remember
> whether there were any 
> conclusions.
> 
> What you really want to do is to have some XML in a
> string treated as 
> XML, not as a string. That is your question, to
> which I don't have an 
> immediate answer, I'm afraid.
> 
> The other thing to be wary of here is that, if you
> give people the 
> freedom to put what they want into a box like that,
> they can go breaking 
> things quite badly if you don't validate the input
> that they are putting in.
> 
> Sorry I can't help more.
> 
> Regards, Upayavira
> 
> >--- Upayavira <uv...@upaya.co.uk> wrote:
> >
> >  
> >
> >>Wild guess here (never done it myself):
> >>
> >>Could your editBean.note_with_href return a
> >>DOMFragment or DomNode? I 
> >>think the latest Cocoon in SVN might have code to
> >>handle this properly 
> >>in JXTemplate.
> >>
> >>Regards, Upayavira
> >>
> >>Paul Joseph wrote:
> >>
> >>    
> >>
> >>>Hi,
> >>>
> >>>i have a requirement that the user should be able
> >>>      
> >>>
> >>to
> >>    
> >>
> >>>enter a href in a text area ex:
> >>><a
> >>>      
> >>>
>
>>href="http://www.yahoo.com">http://www.yahoo.com</a>
> >>    
> >>
> >>>Then in a different form, that is read only, this
> >>>      
> >>>
> >>href
> >>    
> >>
> >>>should display as a link that can be clicked on.
> >>>
> >>>I tried to do this using the following:
> >>>
> >>><snip>
> >>>
> >>><TD>${editBean.note_with_href}</TD>
> >>>
> >>></snip>
> >>>
> >>>but what I get in the resulting table cell is the
> >>>same thing i.e. 
> >>>
> >>><a
> >>>      
> >>>
>
>>href="http://www.yahoo.com">http://www.yahoo.com</a>
> >>    
> >>
> >>>i.e. the "<" and ">" have been escape to be &lt;
> >>>      
> >>>
> >>and
> >>    
> >>
> >>>&gt;.  A bean.toString() method indicates that
> the
> >>>values in the bean are unescaped.  The values in
> >>>      
> >>>
> >>the
> >>    
> >>
> >>>database also appear to be unescaped.
> >>>
> >>>Who is doing the escaping and how can I prevent
> it
> >>>      
> >>>
> >>>from happening so that I see a clikcable link?
> >>    
> >>
> >>>My sitemap is pretty basic - as follows:
> >>>
> >>><map:match pattern="display-only-pipeline">
> >>> <map:generate type="jx"
> >>>      
> >>>
> >>src="display_template.xml"/>
> >>    
> >>
> >>>      <map:serialize type="html"/>
> >>></map:match>
> >>>
> >>>thanks!
> >>>Paul
> >>>      
> >>>
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how to display html?

Posted by Upayavira <uv...@upaya.co.uk>.
Paul Joseph wrote:

>Thank you for the pointer.
>
>I think I can manage to download the
>JXTemplateGenerator you mention...
>  
>
Er, I think you're already using it. You refer to 
${editBean.note_with_href} which looks like a bit of JEXL from within a 
jx template.

>I am not clear on the DOMFragment/DomNode bit however.
>
>I can make the bean return a DomNode or DOMFragment
>but am not sure what it is or should look like.
>
>Any pointers on this would be helpful.
>
>The text I would like to test out is this:
>
>"Here is a link you can click on for more information:
><a
>href="http://www.yahoo.com">http://www.yahoo.com</a>"
>
>What would this have to look like to be treated as a
>DomNode?
>  
>
DOM is the Document Object Model, and it is part of Java's way of 
handling XML. It is an object that represents XML as tree structures in 
memory.

See, if you aren't going to find this an easy approach, I think you 
might be going the wrong route. I remember discussions about including 
XML in strings in JXTemplate, but cannot remember whether there were any 
conclusions.

What you really want to do is to have some XML in a string treated as 
XML, not as a string. That is your question, to which I don't have an 
immediate answer, I'm afraid.

The other thing to be wary of here is that, if you give people the 
freedom to put what they want into a box like that, they can go breaking 
things quite badly if you don't validate the input that they are putting in.

Sorry I can't help more.

Regards, Upayavira

>--- Upayavira <uv...@upaya.co.uk> wrote:
>
>  
>
>>Wild guess here (never done it myself):
>>
>>Could your editBean.note_with_href return a
>>DOMFragment or DomNode? I 
>>think the latest Cocoon in SVN might have code to
>>handle this properly 
>>in JXTemplate.
>>
>>Regards, Upayavira
>>
>>Paul Joseph wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>i have a requirement that the user should be able
>>>      
>>>
>>to
>>    
>>
>>>enter a href in a text area ex:
>>><a
>>>      
>>>
>>href="http://www.yahoo.com">http://www.yahoo.com</a>
>>    
>>
>>>Then in a different form, that is read only, this
>>>      
>>>
>>href
>>    
>>
>>>should display as a link that can be clicked on.
>>>
>>>I tried to do this using the following:
>>>
>>><snip>
>>>
>>><TD>${editBean.note_with_href}</TD>
>>>
>>></snip>
>>>
>>>but what I get in the resulting table cell is the
>>>same thing i.e. 
>>>
>>><a
>>>      
>>>
>>href="http://www.yahoo.com">http://www.yahoo.com</a>
>>    
>>
>>>i.e. the "<" and ">" have been escape to be &lt;
>>>      
>>>
>>and
>>    
>>
>>>&gt;.  A bean.toString() method indicates that the
>>>values in the bean are unescaped.  The values in
>>>      
>>>
>>the
>>    
>>
>>>database also appear to be unescaped.
>>>
>>>Who is doing the escaping and how can I prevent it
>>>      
>>>
>>>from happening so that I see a clikcable link?
>>    
>>
>>>My sitemap is pretty basic - as follows:
>>>
>>><map:match pattern="display-only-pipeline">
>>> <map:generate type="jx"
>>>      
>>>
>>src="display_template.xml"/>
>>    
>>
>>>      <map:serialize type="html"/>
>>></map:match>
>>>
>>>thanks!
>>>Paul
>>>      
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how to display html?

Posted by Paul Joseph <pj...@yahoo.com>.
Thank you for the pointer.

I think I can manage to download the
JXTemplateGenerator you mention...

I am not clear on the DOMFragment/DomNode bit however.

I can make the bean return a DomNode or DOMFragment
but am not sure what it is or should look like.

Any pointers on this would be helpful.

The text I would like to test out is this:

"Here is a link you can click on for more information:
<a
href="http://www.yahoo.com">http://www.yahoo.com</a>"

What would this have to look like to be treated as a
DomNode?

thx
Paul
--- Upayavira <uv...@upaya.co.uk> wrote:

> Wild guess here (never done it myself):
> 
> Could your editBean.note_with_href return a
> DOMFragment or DomNode? I 
> think the latest Cocoon in SVN might have code to
> handle this properly 
> in JXTemplate.
> 
> Regards, Upayavira
> 
> Paul Joseph wrote:
> 
> >Hi,
> >
> >i have a requirement that the user should be able
> to
> >enter a href in a text area ex:
> ><a
>
>href="http://www.yahoo.com">http://www.yahoo.com</a>
> >
> >Then in a different form, that is read only, this
> href
> >should display as a link that can be clicked on.
> >
> >I tried to do this using the following:
> >
> ><snip>
> >
> ><TD>${editBean.note_with_href}</TD>
> >
> ></snip>
> >
> > but what I get in the resulting table cell is the
> >same thing i.e. 
> >
> ><a
>
>href="http://www.yahoo.com">http://www.yahoo.com</a>
> >
> >i.e. the "<" and ">" have been escape to be &lt;
> and
> >&gt;.  A bean.toString() method indicates that the
> >values in the bean are unescaped.  The values in
> the
> >database also appear to be unescaped.
> >
> >Who is doing the escaping and how can I prevent it
> >from happening so that I see a clikcable link?
> >
> >My sitemap is pretty basic - as follows:
> >
> ><map:match pattern="display-only-pipeline">
> >  <map:generate type="jx"
> src="display_template.xml"/>
> >       <map:serialize type="html"/>
> ></map:match>
> >
> >thanks!
> >Paul
> >
> >
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail:
> users-help@cocoon.apache.org
> >
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how to display html?

Posted by Upayavira <uv...@upaya.co.uk>.
Wild guess here (never done it myself):

Could your editBean.note_with_href return a DOMFragment or DomNode? I 
think the latest Cocoon in SVN might have code to handle this properly 
in JXTemplate.

Regards, Upayavira

Paul Joseph wrote:

>Hi,
>
>i have a requirement that the user should be able to
>enter a href in a text area ex:
><a
>href="http://www.yahoo.com">http://www.yahoo.com</a>
>
>Then in a different form, that is read only, this href
>should display as a link that can be clicked on.
>
>I tried to do this using the following:
>
><snip>
>
><TD>${editBean.note_with_href}</TD>
>
></snip>
>
> but what I get in the resulting table cell is the
>same thing i.e. 
>
><a
>href="http://www.yahoo.com">http://www.yahoo.com</a>
>
>i.e. the "<" and ">" have been escape to be &lt; and
>&gt;.  A bean.toString() method indicates that the
>values in the bean are unescaped.  The values in the
>database also appear to be unescaped.
>
>Who is doing the escaping and how can I prevent it
>from happening so that I see a clikcable link?
>
>My sitemap is pretty basic - as follows:
>
><map:match pattern="display-only-pipeline">
>  <map:generate type="jx" src="display_template.xml"/>
>       <map:serialize type="html"/>
></map:match>
>
>thanks!
>Paul
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: how to display html?

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Paul Joseph wrote:
> Hi,
> 
> i have a requirement that the user should be able to
> enter a href in a text area ex:
> <a
> href="http://www.yahoo.com">http://www.yahoo.com</a>
> 
> Then in a different form, that is read only, this href
> should display as a link that can be clicked on.
> 
> I tried to do this using the following:
> 
> <snip>
> 
> <TD>${editBean.note_with_href}</TD>
first .. your html fragment has to be valid xhtml
then:

http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108607961802107&w=2
will point you with some answers.

	lg
-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org