I tried to add the XML declaration manually with:

DOESN'T WORK
--------- app/views/layouts/application.html.haml
<?xml version="1.0" encoding="utf-8"?>
---------

But this doesn't show anything. Adding a *space* before the question
mark does show the tag. Is there some regex stuff going on here that
rejects tags that start with a question mark?

WORKS, MIND THE SPACE
--------- app/views/layouts/application.html.haml
< ?xml version="1.0" encoding="utf-8"?>
---------

Hope this helps pointing in the right direction.

On Aug 27, 8:36 pm, Peter <[email protected]> wrote:
> Hi DAZ and Nathan,
>
> I have exactly the same problem in a Rails 3 RC 2 application. Started
> an application from scratch with only the HAML gem, ran a 'bundle
> install' and added an haml.rb file in the config/initializers file
> which sets the default to :xhtml, here it is:
>
> --------- config/initializers/haml.rb
> Haml::Template.options[:format] = :xhtml
> ---------
>
> Next I have the following in my application.html.haml:
>
> --------- app/views/layouts/application.html.haml
> !!! XML
> %p This file should have an XML declaration but doesn't.
> ----------
>
> When I remove the XML or replace it with 5, Mobile or any other tag it
> works fine but the XML is ignored. Am I missing something?
>
> Thanks!
>
> On Aug 27, 3:54 pm, DAZ <[email protected]> wrote:
>
>
>
> > Thanks Nathan,
> > I'm using Sinatra 1.0. I tried using :format => :xhtml and still the
> > same problem! Not sure what's going on...
>
> > DAZ
>
> > On Aug 26, 7:07 pm, Nathan Weizenbaum <[email protected]> wrote:
>
> > > You're probably using Rails 3, in which case Haml defaults to HTML5 
> > > format,
> > > in which XML headers don't show up. You need to set :format => :xhtml for
> > > this to work.
>
> > > On Thu, Aug 26, 2010 at 8:02 AM, DAZ <[email protected]> wrote:
> > > > I'm using the following code to generate an rss feed:
>
> > > > !!! xml
> > > > %feed(xmlns="http://www.w3.org/2005/Atom";)
> > > > %title= settings.title
> > > > %id= settings.url
> > > > %updated= @posts.first[:created_at] if @posts.any?
> > > > %author
> > > >  %name= settings.author
>
> > > > But the output is this:
> > > > <feed xmlns='http://www.w3.org/2005/Atom'></feed>
> > > > <title>Bloggl</title>
> > > > <id>http://bloggl.com</id>
> > > > <updated>2010-08-26T15:37:35+01:00</updated>
> > > > <author>
> > > >  <name>DAZ</name>
> > > > </author>
>
> > > > The !!! xml line doesn't seem to be producing
> > > > <?xml version = "1.0" encoding = "UTF-8"?>
>
> > > > Anybody know what's going wrong here?
>
> > > > cheers,
>
> > > > DAZ
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Haml" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected] <haml%[email protected]>.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/haml?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to