commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kohsuke Kawaguchi (JIRA)" <j...@apache.org>
Subject [jira] Created: (JEXL-18) Whitespace normalization in Jelly is wrong
Date Tue, 08 Aug 2006 01:49:16 GMT
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


Mime
View raw message