You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Randahl Fink Isaksen <ra...@rockit.dk> on 2006/10/17 13:26:13 UTC

MyFaces renders a space in
- can I turn that off?

MyFaces seems to follow the browser compatibility recommendations of 
XHTML and outputs a space inside empty elements like this:

<br /> instead of <br/>

These recommendations were written back in 2000 (as can be seen here 
http://www.w3.org/TR/html/#C_2), and today I would like to output normal 
XML in which there is not a space inside empty elements.

Is it possible to configure MyFaces to render empty elements without spaces?

Randahl


Re: MyFaces renders a space in
- can I turn that off?

Posted by Randahl Fink Isaksen <ra...@rockit.dk>.
Great! Thanks.

R.

Jeff Bischoff wrote:
> Randahl Fink Isaksen wrote:
>> Has anyone else got some comments about tag output customization 
>> before we move on to filing an RFE somewhere?
>>
>
> In case you haven't found it yet, that "somewhere" would be here [1]. :)
>
> [1] http://issues.apache.org/jira/browse/MYFACES
>
>
>
>


Re: MyFaces renders a space in
- can I turn that off?

Posted by Jeff Bischoff <jb...@klkurz.com>.
Randahl Fink Isaksen wrote:
> Has anyone else got some comments about tag output customization before 
> we move on to filing an RFE somewhere?
> 

In case you haven't found it yet, that "somewhere" would be here [1]. :)

[1] http://issues.apache.org/jira/browse/MYFACES



Re: MyFaces renders a space in
- can I turn that off?

Posted by Randahl Fink Isaksen <ra...@rockit.dk>.
We totally agree - it was in no way my intention to state that the <br 
/> output is invalid XML, but it sure looks odd or, in your words, not 
customary. I am using MyFaces with facelets where it is customary to 
output handwritten XHTML tags in your view xml files, and when I 
handwrite a br tag it is of course written <br/>, so next to the <br /> 
tags from MyFaces it shows that the output is a mixture of syntaxes.

Has anyone else got some comments about tag output customization before 
we move on to filing an RFE somewhere?

Randahl




Jeff Bischoff wrote:
> Randahl Fink Isaksen wrote:
>> Because it also states here
>>
>> http://www.w3.org/TR/html/#h-4.6
>>
>> That the correct way to write empty tags like br is <br/> with no space. 
>
> I see nothing in section 4.6 of the linked document that supports your 
> assertion. What it actually says is:
>
> "Empty elements must either have an end tag or the start tag must end 
> with />."
>
> So, as far as the XHTML standard is concerned, all of the following 
> are valid:
>
> <br/>
> <br />
> <br   />
> <br></br>
>
> > You can compare this to the problem with <script/> not working on IE.
> > The intermediate solution is to output <script></script>, which works
> > fine. But as soon as IE7 has found its way to most IE users, I think it
> > is time to output the tag in the correct way, namely <script/>.
>
> These are both valid expressions of the tag under the spec. I think 
> perhaps you are saying "correct" where it would be more accurate to 
> say "customary." Are the minimized forms cleaner, nicer, more elegant? 
> I would say yes. But that does not make the other forms incorrect.
>
> In any case, I see nothing wrong with having the option to output in 
> different forms. (e.g. compatible, minimized) After all, we do have 
> the PRETTY_HTML option in tomahawk already. So clearly some of us at 
> least are concerned about the appearance of the generated code. Maybe 
> you can get some support for your idea and get some dev involved. 
> Otherwise, you would be stuck having to provide a patch yourself.
>
> Regards,
>
> Jeff Bischoff
> Kenneth L Kurz & Associates, Inc.
>
>
>
>


Re: MyFaces renders a space in
- can I turn that off?

Posted by Jeff Bischoff <jb...@klkurz.com>.
Randahl Fink Isaksen wrote:
> Because it also states here
> 
> http://www.w3.org/TR/html/#h-4.6
> 
> That the correct way to write empty tags like br is <br/> with no space. 

I see nothing in section 4.6 of the linked document that supports your 
assertion. What it actually says is:

"Empty elements must either have an end tag or the start tag must end 
with />."

So, as far as the XHTML standard is concerned, all of the following are 
valid:

<br/>
<br />
<br   />
<br></br>

 > You can compare this to the problem with <script/> not working on IE.
 > The intermediate solution is to output <script></script>, which works
 > fine. But as soon as IE7 has found its way to most IE users, I think it
 > is time to output the tag in the correct way, namely <script/>.

These are both valid expressions of the tag under the spec. I think 
perhaps you are saying "correct" where it would be more accurate to say 
"customary." Are the minimized forms cleaner, nicer, more elegant? I 
would say yes. But that does not make the other forms incorrect.

In any case, I see nothing wrong with having the option to output in 
different forms. (e.g. compatible, minimized) After all, we do have the 
PRETTY_HTML option in tomahawk already. So clearly some of us at least 
are concerned about the appearance of the generated code. Maybe you can 
get some support for your idea and get some dev involved. Otherwise, you 
would be stuck having to provide a patch yourself.

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.



Re: MyFaces renders a space in
- can I turn that off?

Posted by Randahl Fink Isaksen <ra...@rockit.dk>.
Because it also states here

http://www.w3.org/TR/html/#h-4.6

That the correct way to write empty tags like br is <br/> with no space. 
The first link I provided (see below) points to what I interpret as an 
intermediate solution to support older browsers. The W3C document was 
written back in 2000 and I would expect all modern browsers to be able 
to understand <br/>, hence I think it is unnecessary to output spaces in 
all empty tags.

You can compare this to the problem with <script/> not working on IE. 
The intermediate solution is to output <script></script>, which works 
fine. But as soon as IE7 has found its way to most IE users, I think it 
is time to output the tag in the correct way, namely <script/>.

So my question remains: In a project which is targeted at newer 
browsers, can I configure MyFaces to output regular XHTML in which <br/> 
is written instead of the backwards compatible <br />?

Randahl




Andrew Robinson wrote:
> The w3c from that link link says it *should* print a space before the
> slash. Why do you want to turn the space off since it is "required"
> for HTML compatibility? As for XML the space before the slash doesn't
> matter (XML parsers don't care about whitespace in a tag).
>
> On 10/17/06, Randahl Fink Isaksen <ra...@rockit.dk> wrote:
>> MyFaces seems to follow the browser compatibility recommendations of
>> XHTML and outputs a space inside empty elements like this:
>>
>> <br /> instead of <br/>
>>
>> These recommendations were written back in 2000 (as can be seen here
>> http://www.w3.org/TR/html/#C_2), and today I would like to output normal
>> XML in which there is not a space inside empty elements.
>>
>> Is it possible to configure MyFaces to render empty elements without 
>> spaces?
>>
>> Randahl
>>
>>
>
>


Re: MyFaces renders a space in
- can I turn that off?

Posted by Andrew Robinson <an...@gmail.com>.
The w3c from that link link says it *should* print a space before the
slash. Why do you want to turn the space off since it is "required"
for HTML compatibility? As for XML the space before the slash doesn't
matter (XML parsers don't care about whitespace in a tag).

On 10/17/06, Randahl Fink Isaksen <ra...@rockit.dk> wrote:
> MyFaces seems to follow the browser compatibility recommendations of
> XHTML and outputs a space inside empty elements like this:
>
> <br /> instead of <br/>
>
> These recommendations were written back in 2000 (as can be seen here
> http://www.w3.org/TR/html/#C_2), and today I would like to output normal
> XML in which there is not a space inside empty elements.
>
> Is it possible to configure MyFaces to render empty elements without spaces?
>
> Randahl
>
>