2009/10/4 David Chang <david_q_zh...@yahoo.com>:
> Phil,
>
> Thanks very much for your reply. By XML declaration, you mean something like:
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> Correct? I found this piece and it may be interesting to all:

That's right.

> http://learningtheworld.eu/2008/farewell-xml-declaration/

Well, it might make sense to skip the xml declaration when the output
is being pushed straight the user agent (as with JSP, PHP etc), but
with Wicket you require a full parsing of the xhtml data on the server
side, so I would go with the best practice approach and keep the
declaration.  Wicket is much more able to transform xhtml than other
frameworks, so the arguments aren't really the same.

>>>I prefer to include it in my source, and then have
> Wicket strip it out at the last moment - at least when I'm forced to
> be IE6 compatible
>
> I am interested in this solution. Could you please share with us the detailed 
> how-to?

There's no particular secret, just call
this.getMarkupSettings().setStripXmlDeclarationFromOutput(true); in
your Application.init() method.

> Regards.
>
> --- On Sun, 10/4/09, Phil Housley <undeconstruc...@gmail.com> wrote:
>
>> From: Phil Housley <undeconstruc...@gmail.com>
>> Subject: Re: Start a panel, border, or page with an XML declaration?
>> To: users@wicket.apache.org
>> Date: Sunday, October 4, 2009, 6:59 AM
>> 2009/10/4 David Chang <david_q_zh...@yahoo.com>:
>> > Hello, I am reading <<Wicket in Action>>.
>> The Tip on page 291 says "it is good practice to start your
>> panels and  borders (possibly your pages) with an XML
>> declaration to force Wicket to work with them using the
>> proper encoding".
>> >
>> > Does this mean that starting a panel, border, or page
>> with something such as the following:
>> > ----------
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
>> Transitional//EN"
>> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> > <html xmlns="http://www.w3.org/1999/xhtml"; lang="en"
>> xml:lang="en">
>> > <head>
>> > <meta http-equiv="content-type" content="text/html;
>> charset=utf-8" />
>> > ...
>> > </head>
>> > ----------
>>
>> Actually, the xml declaration is the one starting <?xml,
>> which
>> includes your encoding as soon as possible in the file,
>> before any
>> actual content.  Adding the doctype is also good
>> practice, as it makes
>> sure wicket/the browser/anything else that reads the file
>> understands
>> it exactly as you wrote it, but is a separate issue.
>>
>> >
>> > is better than with:
>> > ----------
>> > <html>
>> > <head>
>> > ...
>> > </head>
>> > ----------
>>
>> > If yes, why do all the examples of the WIA book start
>> simply with <html><head>...</head>?
>>
>> To save space I assume.
>>
>> > Thanks for your help!
>> >
>>
>> One final thing to note is that IE6 will screw up any page
>> with an
>> <?xml declaration.  I prefer to include it in my
>> source, and then have
>> Wicket strip it out at the last moment - at least when I'm
>> forced to
>> be IE6 compatible.

-- 
Phil Housley

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to