You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peter Nabbefeld <Pe...@gmx.de> on 2004/07/03 21:40:16 UTC

[jelly]Tags in strings

Hello,

I've tried the following:

         <j:invokeStatic className="javax.swing.JOptionPane" 
method="showMessageDialog">
           <j:arg type="java.awt.Component"/>
           <j:set var="help.browser.error.message"><![CDATA[<html>This 
is just a <i>simple</i>test.</html>]]></j:set>
           <j:arg type="java.lang.Object" 
value="${help.browser.error.message}"/>
         </j:invokeStatic>

I've got all the tags escaped ("&lt;html&gt; ...") - why?

Kind regards

Peter Nabbefeld


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [jelly]Tags in strings

Posted by Peter Nabbefeld <Pe...@gmx.de>.
Paul Libbrecht schrieb:

> A suggestion for better formulation ?
>
> paul
>
Sets whether the body of the tag should be XML encoded as text (so that 
< and > are encoded as & lt; and & gt;) or leave the text as XML. The 
default is to encode.  ...

That's how it worked ...

peter

>
> Le 6-Jul-04, à 10:38 Uhr, Peter Nabbefeld a écrit :
>
>> in the meantime I've found out, that the CDATA trick does it, but the 
>> description of 'core:set' is misleading and should be clarified. For 
>> the attribute 'encode' it says:
>> Sets whether the body of the tag should be XML encoded as text (so 
>> that < and > are encoded as & lt; and & gt;) or leave the text as XML 
>> which is the default. This is only used if this tag is specified with 
>> no value so that the text body of this tag is used as the body.
>>
>> I understand this, that the default is to not encode the tags - while 
>> I've found that I've to set this attribute explicitly to false - then 
>> it works.
>>
>> Kind regards
>>
>> Peter Nabbefeld
>>
>>
>> Paul Libbrecht schrieb:
>>
>>> Well, this seems to be a bug but after thinking of it, it's not one !
>>>
>>> <j:set var="blop">My XML Content</j:set>
>>>
>>> will load the content "My XML Content" as XML... if you want the 
>>> string "<" in there, it has to be passed as &lt; (otherwise it 
>>> couldn't pass the "<" of the tags).
>>>
>>> Here's two ways to do what you probably want:
>>>
>>> <j:set var="help.browser.error.message"
>>>     value="&lt;html&gt;This is just a 
>>> &lt;i&gt;simple&lt;/i&gt;test.&lt;/html&gt;"/>
>>>
>>> <j:set var="help.browser.error.message"><html>This is just a 
>>> <i>simple</i> test.</html></j:set>
>>>
>>> But be careful if running this from maven, the parser might bite 
>>> you: any ant or werkz tag can be written in the no-namespace world. 
>>> WHich means that you can't safely input "<jar>" as part of that.
>>>
>>> Maybe, to suit your needs, you would wish something like the very 
>>> dirty "disable-output-escaping" attribute of XSLT... you'll need to 
>>> file a feature request, hopefully with a patch.
>>>
>>> paul
>>>
>>>
>>> Le 3-Jul-04, à 21:40 Uhr, Peter Nabbefeld a écrit :
>>>
>>>> I've tried the following:
>>>>
>>>>         <j:invokeStatic className="javax.swing.JOptionPane" 
>>>> method="showMessageDialog">
>>>>           <j:arg type="java.awt.Component"/>
>>>>           <j:set 
>>>> var="help.browser.error.message"><![CDATA[<html>This is just a 
>>>> <i>simple</i>test.</html>]]></j:set>
>>>>           <j:arg type="java.lang.Object" 
>>>> value="${help.browser.error.message}"/>
>>>>         </j:invokeStatic>
>>>>
>>>> I've got all the tags escaped ("&lt;html&gt; ...") - why?
>>>>
>>>> Kind regards
>>>>
>>>> Peter Nabbefeld
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [jelly]Tags in strings

Posted by Paul Libbrecht <pa...@activemath.org>.
A suggestion for better formulation ?

paul


Le 6-Jul-04, à 10:38 Uhr, Peter Nabbefeld a écrit :
> in the meantime I've found out, that the CDATA trick does it, but the 
> description of 'core:set' is misleading and should be clarified. For 
> the attribute 'encode' it says:
> Sets whether the body of the tag should be XML encoded as text (so 
> that < and > are encoded as & lt; and & gt;) or leave the text as XML 
> which is the default. This is only used if this tag is specified with 
> no value so that the text body of this tag is used as the body.
>
> I understand this, that the default is to not encode the tags - while 
> I've found that I've to set this attribute explicitly to false - then 
> it works.
>
> Kind regards
>
> Peter Nabbefeld
>
>
> Paul Libbrecht schrieb:
>
>> Well, this seems to be a bug but after thinking of it, it's not one !
>>
>> <j:set var="blop">My XML Content</j:set>
>>
>> will load the content "My XML Content" as XML... if you want the 
>> string "<" in there, it has to be passed as &lt; (otherwise it 
>> couldn't pass the "<" of the tags).
>>
>> Here's two ways to do what you probably want:
>>
>> <j:set var="help.browser.error.message"
>>     value="&lt;html&gt;This is just a 
>> &lt;i&gt;simple&lt;/i&gt;test.&lt;/html&gt;"/>
>>
>> <j:set var="help.browser.error.message"><html>This is just a 
>> <i>simple</i> test.</html></j:set>
>>
>> But be careful if running this from maven, the parser might bite you: 
>> any ant or werkz tag can be written in the no-namespace world. WHich 
>> means that you can't safely input "<jar>" as part of that.
>>
>> Maybe, to suit your needs, you would wish something like the very 
>> dirty "disable-output-escaping" attribute of XSLT... you'll need to 
>> file a feature request, hopefully with a patch.
>>
>> paul
>>
>>
>> Le 3-Jul-04, à 21:40 Uhr, Peter Nabbefeld a écrit :
>>
>>> I've tried the following:
>>>
>>>         <j:invokeStatic className="javax.swing.JOptionPane" 
>>> method="showMessageDialog">
>>>           <j:arg type="java.awt.Component"/>
>>>           <j:set 
>>> var="help.browser.error.message"><![CDATA[<html>This is just a 
>>> <i>simple</i>test.</html>]]></j:set>
>>>           <j:arg type="java.lang.Object" 
>>> value="${help.browser.error.message}"/>
>>>         </j:invokeStatic>
>>>
>>> I've got all the tags escaped ("&lt;html&gt; ...") - why?
>>>
>>> Kind regards
>>>
>>> Peter Nabbefeld
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [jelly]Tags in strings

Posted by Peter Nabbefeld <Pe...@gmx.de>.
Thank You Paul,

in the meantime I've found out, that the CDATA trick does it, but the 
description of 'core:set' is misleading and should be clarified. For the 
attribute 'encode' it says:
Sets whether the body of the tag should be XML encoded as text (so that 
< and > are encoded as & lt; and & gt;) or leave the text as XML which 
is the default. This is only used if this tag is specified with no value 
so that the text body of this tag is used as the body.

I understand this, that the default is to not encode the tags - while 
I've found that I've to set this attribute explicitly to false - then it 
works.

Kind regards

Peter Nabbefeld


Paul Libbrecht schrieb:

> Well, this seems to be a bug but after thinking of it, it's not one !
>
> <j:set var="blop">My XML Content</j:set>
>
> will load the content "My XML Content" as XML... if you want the 
> string "<" in there, it has to be passed as &lt; (otherwise it 
> couldn't pass the "<" of the tags).
>
> Here's two ways to do what you probably want:
>
> <j:set var="help.browser.error.message"
>     value="&lt;html&gt;This is just a 
> &lt;i&gt;simple&lt;/i&gt;test.&lt;/html&gt;"/>
>
> <j:set var="help.browser.error.message"><html>This is just a 
> <i>simple</i> test.</html></j:set>
>
> But be careful if running this from maven, the parser might bite you: 
> any ant or werkz tag can be written in the no-namespace world. WHich 
> means that you can't safely input "<jar>" as part of that.
>
> Maybe, to suit your needs, you would wish something like the very 
> dirty "disable-output-escaping" attribute of XSLT... you'll need to 
> file a feature request, hopefully with a patch.
>
> paul
>
>
> Le 3-Jul-04, à 21:40 Uhr, Peter Nabbefeld a écrit :
>
>> I've tried the following:
>>
>>         <j:invokeStatic className="javax.swing.JOptionPane" 
>> method="showMessageDialog">
>>           <j:arg type="java.awt.Component"/>
>>           <j:set var="help.browser.error.message"><![CDATA[<html>This 
>> is just a <i>simple</i>test.</html>]]></j:set>
>>           <j:arg type="java.lang.Object" 
>> value="${help.browser.error.message}"/>
>>         </j:invokeStatic>
>>
>> I've got all the tags escaped ("&lt;html&gt; ...") - why?
>>
>> Kind regards
>>
>> Peter Nabbefeld
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [jelly]Tags in strings

Posted by Paul Libbrecht <pa...@activemath.org>.
Well, this seems to be a bug but after thinking of it, it's not one !

<j:set var="blop">My XML Content</j:set>

will load the content "My XML Content" as XML... if you want the string 
"<" in there, it has to be passed as &lt; (otherwise it couldn't pass 
the "<" of the tags).

Here's two ways to do what you probably want:

<j:set var="help.browser.error.message"
	value="&lt;html&gt;This is just a 
&lt;i&gt;simple&lt;/i&gt;test.&lt;/html&gt;"/>

<j:set var="help.browser.error.message"><html>This is just a 
<i>simple</i> test.</html></j:set>

But be careful if running this from maven, the parser might bite you: 
any ant or werkz tag can be written in the no-namespace world. WHich 
means that you can't safely input "<jar>" as part of that.

Maybe, to suit your needs, you would wish something like the very dirty 
"disable-output-escaping" attribute of XSLT... you'll need to file a 
feature request, hopefully with a patch.

paul


Le 3-Jul-04, à 21:40 Uhr, Peter Nabbefeld a écrit :
> I've tried the following:
>
>         <j:invokeStatic className="javax.swing.JOptionPane" 
> method="showMessageDialog">
>           <j:arg type="java.awt.Component"/>
>           <j:set var="help.browser.error.message"><![CDATA[<html>This 
> is just a <i>simple</i>test.</html>]]></j:set>
>           <j:arg type="java.lang.Object" 
> value="${help.browser.error.message}"/>
>         </j:invokeStatic>
>
> I've got all the tags escaped ("&lt;html&gt; ...") - why?
>
> Kind regards
>
> Peter Nabbefeld
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org