You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Kohsuke Kawaguchi (JIRA)" <ji...@apache.org> on 2006/08/08 03:49:16 UTC
[jira] Created: (JEXL-18) Whitespace normalization in Jelly is
wrong
Whitespace normalization in Jelly is wrong
------------------------------------------
Key: JEXL-18
URL: http://issues.apache.org/jira/browse/JEXL-18
Project: Commons JEXL
Issue Type: Bug
Reporter: Kohsuke Kawaguchi
In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
<foo> <bar> // text between two start tags
<foo> </foo> // text between start and end tag
(Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
But the following text are never ignorable whitespaces:
<foo> x <bar>
<foo> y </foo>
Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
<foo>x<bar>
<foo>y</foo>
Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
It is sometimes even harmful, for example because the following text:
<p> some text <b>here</b></p>
... becomes:
<p>some text<b>here</b></p>
and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (JELLY-236) Whitespace normalization in Jelly is
wrong
Posted by "dion gillard (JIRA)" <co...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/JELLY-236?page=comments#action_12426439 ]
dion gillard commented on JELLY-236:
------------------------------------
No, I mean o.a.c.j.TagSupport#setTrim(boolean) which almost all Tags extend at some point.
> Whitespace normalization in Jelly is wrong
> ------------------------------------------
>
> Key: JELLY-236
> URL: http://issues.apache.org/jira/browse/JELLY-236
> Project: Commons Jelly
> Issue Type: Bug
> Reporter: Kohsuke Kawaguchi
>
> In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
> <foo> <bar> // text between two start tags
> <foo> </foo> // text between start and end tag
> (Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
> But the following text are never ignorable whitespaces:
> <foo> x <bar>
> <foo> y </foo>
> Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
> <foo>x<bar>
> <foo>y</foo>
> Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
> It is sometimes even harmful, for example because the following text:
> <p> some text <b>here</b></p>
> ... becomes:
> <p>some text<b>here</b></p>
> and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
> I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
> If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Moved: (JELLY-236) Whitespace normalization in Jelly is
wrong
Posted by "dion gillard (JIRA)" <co...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/JELLY-236?page=all ]
dion gillard moved JEXL-18 to JELLY-236:
----------------------------------------
Project: Commons Jelly (was: Commons JEXL)
Key: JELLY-236 (was: JEXL-18)
> Whitespace normalization in Jelly is wrong
> ------------------------------------------
>
> Key: JELLY-236
> URL: http://issues.apache.org/jira/browse/JELLY-236
> Project: Commons Jelly
> Issue Type: Bug
> Reporter: Kohsuke Kawaguchi
>
> In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
> <foo> <bar> // text between two start tags
> <foo> </foo> // text between start and end tag
> (Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
> But the following text are never ignorable whitespaces:
> <foo> x <bar>
> <foo> y </foo>
> Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
> <foo>x<bar>
> <foo>y</foo>
> Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
> It is sometimes even harmful, for example because the following text:
> <p> some text <b>here</b></p>
> ... becomes:
> <p>some text<b>here</b></p>
> and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
> I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
> If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (JELLY-236) Whitespace normalization in Jelly is
wrong
Posted by "Kohsuke Kawaguchi (JIRA)" <co...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/JELLY-236?page=comments#action_12426435 ]
Kohsuke Kawaguchi commented on JELLY-236:
-----------------------------------------
I'm not sure if I understand the question. Sorry. You mean String.trim()?
> Whitespace normalization in Jelly is wrong
> ------------------------------------------
>
> Key: JELLY-236
> URL: http://issues.apache.org/jira/browse/JELLY-236
> Project: Commons Jelly
> Issue Type: Bug
> Reporter: Kohsuke Kawaguchi
>
> In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
> <foo> <bar> // text between two start tags
> <foo> </foo> // text between start and end tag
> (Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
> But the following text are never ignorable whitespaces:
> <foo> x <bar>
> <foo> y </foo>
> Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
> <foo>x<bar>
> <foo>y</foo>
> Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
> It is sometimes even harmful, for example because the following text:
> <p> some text <b>here</b></p>
> ... becomes:
> <p>some text<b>here</b></p>
> and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
> I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
> If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (JELLY-236) Whitespace normalization in Jelly is
wrong
Posted by "dion gillard (JIRA)" <co...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/JELLY-236?page=comments#action_12426391 ]
dion gillard commented on JELLY-236:
------------------------------------
How does this affect trim()?
> Whitespace normalization in Jelly is wrong
> ------------------------------------------
>
> Key: JELLY-236
> URL: http://issues.apache.org/jira/browse/JELLY-236
> Project: Commons Jelly
> Issue Type: Bug
> Reporter: Kohsuke Kawaguchi
>
> In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
> <foo> <bar> // text between two start tags
> <foo> </foo> // text between start and end tag
> (Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
> But the following text are never ignorable whitespaces:
> <foo> x <bar>
> <foo> y </foo>
> Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
> <foo>x<bar>
> <foo>y</foo>
> Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
> It is sometimes even harmful, for example because the following text:
> <p> some text <b>here</b></p>
> ... becomes:
> <p>some text<b>here</b></p>
> and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
> I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
> If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (JEXL-18) Whitespace normalization in Jelly is
wrong
Posted by "Kohsuke Kawaguchi (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/JEXL-18?page=comments#action_12426389 ]
Kohsuke Kawaguchi commented on JEXL-18:
---------------------------------------
D'oh! This is supposed to be filed against Jelly, not Jexl. But I don't seem to be able to reassign it, or even just to close it.
If whoever with enough karma can reassign this to Jelly or just close it, that would be appreciated.
> Whitespace normalization in Jelly is wrong
> ------------------------------------------
>
> Key: JEXL-18
> URL: http://issues.apache.org/jira/browse/JEXL-18
> Project: Commons JEXL
> Issue Type: Bug
> Reporter: Kohsuke Kawaguchi
>
> In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
> <foo> <bar> // text between two start tags
> <foo> </foo> // text between start and end tag
> (Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
> But the following text are never ignorable whitespaces:
> <foo> x <bar>
> <foo> y </foo>
> Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
> <foo>x<bar>
> <foo>y</foo>
> Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
> It is sometimes even harmful, for example because the following text:
> <p> some text <b>here</b></p>
> ... becomes:
> <p>some text<b>here</b></p>
> and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
> I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
> If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (JELLY-236) Whitespace normalization in Jelly is
wrong
Posted by "Kohsuke Kawaguchi (JIRA)" <co...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/JELLY-236?page=comments#action_12426637 ]
Kohsuke Kawaguchi commented on JELLY-236:
-----------------------------------------
The change I made was to change the way the trimming happens. Specifically, I changed TagUtils.trimScript() and methods that are called from there, to perform the whitespace stripping like XSLT.
So the compatibility implications are for the generated XML result, not for the code.
> Whitespace normalization in Jelly is wrong
> ------------------------------------------
>
> Key: JELLY-236
> URL: http://issues.apache.org/jira/browse/JELLY-236
> Project: Commons Jelly
> Issue Type: Bug
> Reporter: Kohsuke Kawaguchi
>
> In XML, the convention is to only remove "ignorable whitespaces". Ignorable whitespaces are defined as a text block that entirely consist of whitespaces, surrounded by tags. So the following text are ignorable whitespaces:
> <foo> <bar> // text between two start tags
> <foo> </foo> // text between start and end tag
> (Technically speaking, they are ignorable only when DTD says so, but those are nevertheless people usually consider them pseudo-ignorable even if there's no DTD.)
> But the following text are never ignorable whitespaces:
> <foo> x <bar>
> <foo> y </foo>
> Jelly agressively trims off whitespaces, even if they are not ignorable. So in the above cases, it becomes:
> <foo>x<bar>
> <foo>y</foo>
> Such mode of whitespace normalization is not seen anywhere else, and IMHO it is confusing.
> It is sometimes even harmful, for example because the following text:
> <p> some text <b>here</b></p>
> ... becomes:
> <p>some text<b>here</b></p>
> and you end up losing the significant space character between 'text' and 'here'. As an example of proper whitespace stripping, consult XSLT (http://www.w3.org/TR/1999/REC-xslt-19991116#strip)
> I do realize that one can control the whitespace stripping behavior by using TagSupport.setEscapeText(boolean), but nevertheless I thought I would file a bug to see if the development team is willing to consider this change. I also do realize that this has some non-trivial compatibility implications.
> If you are willing to fix this, I have already patched Jelly locally, so I'm happy to contribute a patch.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org