Quantcast

trimSpaces removing whitespace from html

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

trimSpaces removing whitespace from html

David Kavanagh
Hey,

I am wondering if anyone has come across this issue, and hopefully a way to fix it.
When i enable the trimSpaces configuration option it removes the whitespace but also 
removes some whitespace from particular areas of the html. In my case, it removes white space between some of the classes in a class=" class1 class2 class3" string. In one case, the first example, it actually removes text as well. I am running Tomcat version 8.0.15.

Here are some examples:

1. Before
1. After


2. Before

2. After


3. Before


3. After

Any advice on this would be greatly appreciated.

Kind Regards

David

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

markt
On 10/05/17 17:17, David Kavanagh wrote:

> Hey,
>
> I am wondering if anyone has come across this issue, and hopefully a way
> to fix it.
> When i enable the trimSpaces configuration option it removes the
> whitespace but also
> removes some whitespace from particular areas of the html. In my case,
> it removes white space between some of the classes in a class=" class1
> class2 class3" string. In one case, the first example, it actually
> removes text as well. I am running Tomcat version 8.0.15.
>
> Here are some examples:

The in-line images are removed by the list software.

If you can include the example source and resulting HTML snippets
in-line, that would work better.

Mark



> Any advice on this would be greatly appreciated.
>
> Kind Regards
>
> David
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

David Kavanagh
Thanks for the quick reply.

This is the code that i added to the web.xml file to activate trimSpaces:

        <init-param>
            <param-name>trimSpaces</param-name>
            <param-value>true</param-value>
        </init-param>

This is the HTML code:

1. Before

class="mrf-article mrf-article--photo mrf-page mrf-noFillet mrf-author
mrf-m mrf-image ">


1.After


class="mrf-article mrf-article--photo mrf-page mrf-noFillet mrf-author
mrf-mmrf-image">


2.Before

class="mrf-article mrf-article--photo mrf-page mrf-noFillet mrf-author
mrf-video mrf-m mrf-image ">


2.After


class="mrf-article mrf-article--photo mrf-page mrf-noFillet mrf-author
mrf-mmrf-image">


3.Before

<li id="mrf-messenger" class="mrf-shareOption mrf-brandBkg
mrf-messenger mrf-hidden">


3.After

<li id="mrf-messenger" class="mrf-shareOption mrf-brandBkg
mrf-messengermrf-hidden">


There are many more incidents of the same thing happening.


Thanks


On 10 May 2017 at 20:13, Mark Thomas <[hidden email]> wrote:

> On 10/05/17 17:17, David Kavanagh wrote:
> > Hey,
> >
> > I am wondering if anyone has come across this issue, and hopefully a way
> > to fix it.
> > When i enable the trimSpaces configuration option it removes the
> > whitespace but also
> > removes some whitespace from particular areas of the html. In my case,
> > it removes white space between some of the classes in a class=" class1
> > class2 class3" string. In one case, the first example, it actually
> > removes text as well. I am running Tomcat version 8.0.15.
> >
> > Here are some examples:
>
> The in-line images are removed by the list software.
>
> If you can include the example source and resulting HTML snippets
> in-line, that would work better.
>
> Mark
>
>
>
> > Any advice on this would be greatly appreciated.
> >
> > Kind Regards
> >
> > David
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

Christopher Schultz-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



David,

On 5/11/17 3:27 AM, David Kavanagh wrote:
> Thanks for the quick reply.
>
> This is the code that i added to the web.xml file to activate
trimSpaces:

>
> <init-param> <param-name>trimSpaces</param-name>
> <param-value>true</param-value> </init-param>
>
> This is the HTML code:
>
> 1. Before
>
> class="mrf-article mrf-article--photo mrf-page mrf-noFillet
> mrf-author mrf-m mrf-image ">
>
>
> 1.After
>
>
> class="mrf-article mrf-article--photo mrf-page mrf-noFillet
> mrf-author mrf-mmrf-image">

So, removing the trailing space in the "class" attribute's value?

> 2.Before
>
> class="mrf-article mrf-article--photo mrf-page mrf-noFillet
> mrf-author mrf-video mrf-m mrf-image ">
>
>
> 2.After
>
>
> class="mrf-article mrf-article--photo mrf-page mrf-noFillet
> mrf-author mrf-mmrf-image">

This is the same thing, right?

> 3.Before
>
> <li id="mrf-messenger" class="mrf-shareOption mrf-brandBkg
> mrf-messenger mrf-hidden">
>
>
> 3.After
>
> <li id="mrf-messenger" class="mrf-shareOption mrf-brandBkg
> mrf-messengermrf-hidden">

And here as well?

> There are many more incidents of the same thing happening.

Are you using .jsp or .jspx?

If .jspx, then you are subject to the XML spec's rules for normalizing
element attribute values[1]. Specifically, this part:

"
[T]he XML processor MUST further process the normalized attribute value
by discarding any leading and trailing space (#x20) characters[.]
"

- -chris

[1] https://www.w3.org/TR/REC-xml/#AVNormalize


-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlkUZewACgkQHPApP6U8
pFgaUw/9HQYmHdTsQvt9UppCrRbp+2MAJ0CbyC9VdEvtjscMJ7e0McZCKEeBVRsv
XBIAjO4DH+fbQhSXojBwOdV6uaNCqBbUCrvnx6INcDTCSa0LG81DgZvjSa7gsY/b
Nv4OHPfFqVX38UPj6hsR+/PH8ZZ4rI7CUMRwrR3Dy8k//qdUWXY+TrOaTVx/OaIN
tqD5sKQUjT+TapyF0iSfI/dpP1RSfz6pJvVIQQAl42+UkzHunti0pcEWqwsj6+vM
Ubq9vA+9PUN6dOtPRM4WpBNYWgpNfRLLWvF0zgmy1aNBUJewZc4EVL69yWk67PKj
UymWV/oEhPPnHq2xpPG852D21su28aSZ3IRUlIYWioAzCZ8KZAZrSwEezIJ+3bzm
XNNQD45HO7QDRhD+msKTaR8FXuEnrRvXZ/wpro+mb0nNa9rBPswKPEPqh12WL/nH
CzGEwi4tyikz8sH5M/huMpw9kbn9+wNsMKbqNKOQQgBPA0/RwHFi7M5J+BLYqpwx
HlpdRpFy+HOdnDT7qhdm4q27iRszbf78+O2nTKVXFAv37BO08tSh+KG3rrkZecyL
QEIFNBEnQYt+S+7PmL0QClGSnYU9Thli+YAeydvnkcGCfLJdXT4LcVszTucTyaB/
YgZ/h3ubiWqukWL1H+4xmzNFwlaHVR86XA59kYf6B3xiAkQyblI=
=tWgw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

Torsten Krah-2
Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher Schultz:
> So, removing the trailing space in the "class" attribute's value?

That too - but have a look at:

mrf-mmrf-image

it was before / should be:

mrf-m mrf-image

there are missing whitespaces in the actual class attributes content.

Torsten


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

David Kavanagh
Yes, the problem happens in the class attribute string.
They are some examples but it happened throughout the files in many cases.

I am using .jsp files

Also, in the second example that i gave, you can see that mrf-video was
removed as well as mrf-m and mrf-image being joined.
This was the strangest one to me, and it only happened once in the file.


On 11 May 2017 at 15:33, Torsten Krah <[hidden email]> wrote:

> Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher Schultz:
> > So, removing the trailing space in the "class" attribute's value?
>
> That too - but have a look at:
>
> mrf-mmrf-image
>
> it was before / should be:
>
> mrf-m mrf-image
>
> there are missing whitespaces in the actual class attributes content.
>
> Torsten
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

markt
On 11 May 2017 15:34:32 BST, David Kavanagh <[hidden email]> wrote:

>Yes, the problem happens in the class attribute string.
>They are some examples but it happened throughout the files in many
>cases.
>
>I am using .jsp files
>
>Also, in the second example that i gave, you can see that mrf-video was
>removed as well as mrf-m and mrf-image being joined.
>This was the strangest one to me, and it only happened once in the
>file.
>
>
>On 11 May 2017 at 15:33, Torsten Krah <[hidden email]> wrote:
>
>> Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher
>Schultz:
>> > So, removing the trailing space in the "class" attribute's value?
>>
>> That too - but have a look at:
>>
>> mrf-mmrf-image
>>
>> it was before / should be:
>>
>> mrf-m mrf-image
>>
>> there are missing whitespaces in the actual class attributes content.
>>
>> Torsten
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>

Can you provide the simplest JSP that reproduces this issue?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

David Kavanagh
Yes, this is one of the .jsp files. I don't know how useful this is.
Has anyone heard of a similar issue using trimSpaces before, or do you
think this might be something to do with the particular files being used?

Thanks

<%@taglib prefix="dali" uri="http://dev.marfeel.com/jsp/mrf/dali" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@page pageEncoding="UTF-8" %>

<c:set var="buttonType" value="OPACITYLIGHT" scope="request" />
<dali:article layoutClasses="mrf-article mrf-article--author"
              imageClass="l"
              size="xs"
              layout="${layout}"
              defaultLayoutName="author"
              item="${currentItem}"
              articleTemplate="articleTemplates/author.jsp"
              extended="false"/>

On 11 May 2017 at 18:35, Mark Thomas <[hidden email]> wrote:

> On 11 May 2017 15:34:32 BST, David Kavanagh <[hidden email]>
> wrote:
> >Yes, the problem happens in the class attribute string.
> >They are some examples but it happened throughout the files in many
> >cases.
> >
> >I am using .jsp files
> >
> >Also, in the second example that i gave, you can see that mrf-video was
> >removed as well as mrf-m and mrf-image being joined.
> >This was the strangest one to me, and it only happened once in the
> >file.
> >
> >
> >On 11 May 2017 at 15:33, Torsten Krah <[hidden email]> wrote:
> >
> >> Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher
> >Schultz:
> >> > So, removing the trailing space in the "class" attribute's value?
> >>
> >> That too - but have a look at:
> >>
> >> mrf-mmrf-image
> >>
> >> it was before / should be:
> >>
> >> mrf-m mrf-image
> >>
> >> there are missing whitespaces in the actual class attributes content.
> >>
> >> Torsten
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
>
> Can you provide the simplest JSP that reproduces this issue?
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

markt
On 12/05/17 17:08, David Kavanagh wrote:
> Yes, this is one of the .jsp files. I don't know how useful this is.

Hopefully this will reproduce this. Looking at this is on my TODO list
while I'm at ApacheCon.

> Has anyone heard of a similar issue using trimSpaces before, or do you
> think this might be something to do with the particular files being used?

This isn't anything I recall seeing before. The parsing is all handled
by the JRE. While historically the XML parsing provided by the JRE was
fairly buggy, these days it is much better. One thing on my TODO list is
to check the XML specs to make sure that any required escaping is not
missing or something along those lines.



>
> Thanks
>
> <%@taglib prefix="dali" uri="http://dev.marfeel.com/jsp/mrf/dali" %>
> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
>
> <%@page pageEncoding="UTF-8" %>
>
> <c:set var="buttonType" value="OPACITYLIGHT" scope="request" />
> <dali:article layoutClasses="mrf-article mrf-article--author"
>               imageClass="l"
>               size="xs"
>               layout="${layout}"
>               defaultLayoutName="author"
>               item="${currentItem}"
>               articleTemplate="articleTemplates/author.jsp"
>               extended="false"/>
>
> On 11 May 2017 at 18:35, Mark Thomas <[hidden email]> wrote:
>
>> On 11 May 2017 15:34:32 BST, David Kavanagh <[hidden email]>
>> wrote:
>>> Yes, the problem happens in the class attribute string.
>>> They are some examples but it happened throughout the files in many
>>> cases.
>>>
>>> I am using .jsp files
>>>
>>> Also, in the second example that i gave, you can see that mrf-video was
>>> removed as well as mrf-m and mrf-image being joined.
>>> This was the strangest one to me, and it only happened once in the
>>> file.
>>>
>>>
>>> On 11 May 2017 at 15:33, Torsten Krah <[hidden email]> wrote:
>>>
>>>> Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher
>>> Schultz:
>>>>> So, removing the trailing space in the "class" attribute's value?
>>>>
>>>> That too - but have a look at:
>>>>
>>>> mrf-mmrf-image
>>>>
>>>> it was before / should be:
>>>>
>>>> mrf-m mrf-image
>>>>
>>>> there are missing whitespaces in the actual class attributes content.
>>>>
>>>> Torsten
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>
>> Can you provide the simplest JSP that reproduces this issue?
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

David Kavanagh
Ok cool, hopefully that will reproduce so you can see for yourself.
Thanks!

On 15 May 2017 at 10:39, Mark Thomas <[hidden email]> wrote:

> On 12/05/17 17:08, David Kavanagh wrote:
> > Yes, this is one of the .jsp files. I don't know how useful this is.
>
> Hopefully this will reproduce this. Looking at this is on my TODO list
> while I'm at ApacheCon.
>
> > Has anyone heard of a similar issue using trimSpaces before, or do you
> > think this might be something to do with the particular files being used?
>
> This isn't anything I recall seeing before. The parsing is all handled
> by the JRE. While historically the XML parsing provided by the JRE was
> fairly buggy, these days it is much better. One thing on my TODO list is
> to check the XML specs to make sure that any required escaping is not
> missing or something along those lines.
>
>
>
> >
> > Thanks
> >
> > <%@taglib prefix="dali" uri="http://dev.marfeel.com/jsp/mrf/dali" %>
> > <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> >
> > <%@page pageEncoding="UTF-8" %>
> >
> > <c:set var="buttonType" value="OPACITYLIGHT" scope="request" />
> > <dali:article layoutClasses="mrf-article mrf-article--author"
> >               imageClass="l"
> >               size="xs"
> >               layout="${layout}"
> >               defaultLayoutName="author"
> >               item="${currentItem}"
> >               articleTemplate="articleTemplates/author.jsp"
> >               extended="false"/>
> >
> > On 11 May 2017 at 18:35, Mark Thomas <[hidden email]> wrote:
> >
> >> On 11 May 2017 15:34:32 BST, David Kavanagh <[hidden email]
> >
> >> wrote:
> >>> Yes, the problem happens in the class attribute string.
> >>> They are some examples but it happened throughout the files in many
> >>> cases.
> >>>
> >>> I am using .jsp files
> >>>
> >>> Also, in the second example that i gave, you can see that mrf-video was
> >>> removed as well as mrf-m and mrf-image being joined.
> >>> This was the strangest one to me, and it only happened once in the
> >>> file.
> >>>
> >>>
> >>> On 11 May 2017 at 15:33, Torsten Krah <[hidden email]> wrote:
> >>>
> >>>> Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher
> >>> Schultz:
> >>>>> So, removing the trailing space in the "class" attribute's value?
> >>>>
> >>>> That too - but have a look at:
> >>>>
> >>>> mrf-mmrf-image
> >>>>
> >>>> it was before / should be:
> >>>>
> >>>> mrf-m mrf-image
> >>>>
> >>>> there are missing whitespaces in the actual class attributes content.
> >>>>
> >>>> Torsten
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: [hidden email]
> >>>> For additional commands, e-mail: [hidden email]
> >>>>
> >>>>
> >>
> >> Can you provide the simplest JSP that reproduces this issue?
> >>
> >> Mark
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trimSpaces removing whitespace from html

markt
On 15/05/2017 10:29, David Kavanagh wrote:
> Ok cool, hopefully that will reproduce so you can see for yourself.
> Thanks!

I've done the best I can to reproduce this without the access to the
commerical tag library you appear to be using without success.

I've also checked the trimSpaces implementation and I can't see how an
attribute value could be corrupted.

At this point I'm inclined to think this is not a Tomcat problem. If you
can provide a simple test case (e.g JSP and tag file) that can be
dropped into Tomcat to demonstrate this problem then I'd be happy to
look at this further.

Mark



>
> On 15 May 2017 at 10:39, Mark Thomas <[hidden email]> wrote:
>
>> On 12/05/17 17:08, David Kavanagh wrote:
>>> Yes, this is one of the .jsp files. I don't know how useful this is.
>>
>> Hopefully this will reproduce this. Looking at this is on my TODO list
>> while I'm at ApacheCon.
>>
>>> Has anyone heard of a similar issue using trimSpaces before, or do you
>>> think this might be something to do with the particular files being used?
>>
>> This isn't anything I recall seeing before. The parsing is all handled
>> by the JRE. While historically the XML parsing provided by the JRE was
>> fairly buggy, these days it is much better. One thing on my TODO list is
>> to check the XML specs to make sure that any required escaping is not
>> missing or something along those lines.
>>
>>
>>
>>>
>>> Thanks
>>>
>>> <%@taglib prefix="dali" uri="http://dev.marfeel.com/jsp/mrf/dali" %>
>>> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
>>>
>>> <%@page pageEncoding="UTF-8" %>
>>>
>>> <c:set var="buttonType" value="OPACITYLIGHT" scope="request" />
>>> <dali:article layoutClasses="mrf-article mrf-article--author"
>>>                imageClass="l"
>>>                size="xs"
>>>                layout="${layout}"
>>>                defaultLayoutName="author"
>>>                item="${currentItem}"
>>>                articleTemplate="articleTemplates/author.jsp"
>>>                extended="false"/>
>>>
>>> On 11 May 2017 at 18:35, Mark Thomas <[hidden email]> wrote:
>>>
>>>> On 11 May 2017 15:34:32 BST, David Kavanagh <[hidden email]
>>>
>>>> wrote:
>>>>> Yes, the problem happens in the class attribute string.
>>>>> They are some examples but it happened throughout the files in many
>>>>> cases.
>>>>>
>>>>> I am using .jsp files
>>>>>
>>>>> Also, in the second example that i gave, you can see that mrf-video was
>>>>> removed as well as mrf-m and mrf-image being joined.
>>>>> This was the strangest one to me, and it only happened once in the
>>>>> file.
>>>>>
>>>>>
>>>>> On 11 May 2017 at 15:33, Torsten Krah <[hidden email]> wrote:
>>>>>
>>>>>> Am Donnerstag, den 11.05.2017, 09:23 -0400 schrieb Christopher
>>>>> Schultz:
>>>>>>> So, removing the trailing space in the "class" attribute's value?
>>>>>>
>>>>>> That too - but have a look at:
>>>>>>
>>>>>> mrf-mmrf-image
>>>>>>
>>>>>> it was before / should be:
>>>>>>
>>>>>> mrf-m mrf-image
>>>>>>
>>>>>> there are missing whitespaces in the actual class attributes content.
>>>>>>
>>>>>> Torsten
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>>
>>>>
>>>> Can you provide the simplest JSP that reproduces this issue?
>>>>
>>>> Mark
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...