You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by BORGES Charles <ch...@cegetel.fr> on 2003/10/09 16:52:40 UTC

TR : Problem in SVGSerializer

Hi,

In the configure method of org.apache.cocoon.serialization.SVGSerializer
there is a problem when mapping config parameters to transcoder hints:

When  the parameter type is string, nothing is set. 
For example if you're using 
<parameter name="user_stylesheet_uri" type="string" value="svg.css"/> in the
configuration of a SVGSerializer, the corresponding batik
KEY_USER_STYLESHEET_URI is set to "" In configure():

String keyType = parameters[i].getAttribute("type", "STRING").toUpperCase();
if ("FLOAT".equals(keyType)) {
	// Can throw an exception.
      value = new Float(parameters[i].getAttributeAsFloat("value"));
} else if {

	...

} else {
   	// Assume String, and get the value. Allow an empty string.
      value = parameters[i].getValue("");
}

I think it should be value = parameters[i].getAttribute("value") instead.




Re: TR : Problem in SVGSerializer

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
BORGES Charles wrote:

>Hi,
>
>In the configure method of org.apache.cocoon.serialization.SVGSerializer
>there is a problem when mapping config parameters to transcoder hints:
>
>When  the parameter type is string, nothing is set. 
>For example if you're using 
><parameter name="user_stylesheet_uri" type="string" value="svg.css"/> in the
>configuration of a SVGSerializer, the corresponding batik
>KEY_USER_STYLESHEET_URI is set to "" In configure():
>
>String keyType = parameters[i].getAttribute("type", "STRING").toUpperCase();
>if ("FLOAT".equals(keyType)) {
>	// Can throw an exception.
>      value = new Float(parameters[i].getAttributeAsFloat("value"));
>} else if {
>
>	...
>
>} else {
>   	// Assume String, and get the value. Allow an empty string.
>      value = parameters[i].getValue("");
>}
>
>I think it should be value = parameters[i].getAttribute("value") instead.
>  
>

Actually, this is more an inconsistency than a real bug: when @type is 
"string" or when there's no type, the value is considered as being the 
_content_ of the element, and not the @value attribute, i.e.

<parameter name="foo" type="float" value="6.14"/>
<parameter name="bar" type="string">bar-string-value</parameter>

Anyway, I fixed the inconsistency (2.1 CVS).

Thanks for reporting,
Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com