<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Problem with *.xml.erb files' | Pragmatic Forums</title>
    <link>http://forums.pragprog.com/forums/22/topics/291</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Problem with *.xml.erb files posted by Tony Bianco @ Tue, 04 Mar 2008 22:54:33 -0000</title>
      <description>&lt;p&gt;Here&amp;#8217;s where I went wrong. I named my filed who_bought.xml.erb. What I should have done is named the file who_bought.xml.builder, as soon as I did that it worked!&lt;/p&gt;</description>
      <pubDate>Tue, 04 Mar 2008 22:54:33 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:291:2378</guid>
      <author>Tony Bianco</author>
      <link>http://forums.pragprog.com/forums/22/topics/291</link>
    </item>
    <item>
      <title>Problem with *.xml.erb files posted by Tony Bianco @ Tue, 04 Mar 2008 20:04:32 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;m on one of the last chapters of &lt;span class="caps"&gt;AWDWR&lt;/span&gt; using 2.0 and I&amp;#8217;m at the part where I should be showing xml. The problem is that it seems to not be parsing the xml.&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s my code&lt;/p&gt;


	&lt;p&gt;Controller&lt;br /&gt;&lt;pre&gt;
&lt;code&gt;
class InfoController &amp;lt; ApplicationController

  def who_bought
    respond_to do |format| 
      format.xml {
        @product = Product.find(params[:id])
        @orders = @product.orders
      }
    end
  end
end
&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;View who_bought.xml.erb&lt;br /&gt;&lt;pre&gt;
&lt;code&gt;
xml.order_list(:for_product =&amp;gt; @product.title) do
  for o in @orders
    xml.order do
      xml.name(o.name)
      xml.email(o.email)
    end
  end
end
&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When I go to a page I get this error in the browser and instead of showing xml it just shows what&amp;#8217;s in the *.xml.erb file (example url &lt;a href="http://localhost:3000/info/who_bought/48126371"&gt;http://localhost:3000/info/who_bought/48126371&lt;/a&gt;)&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;&lt;span class="caps"&gt;XML&lt;/span&gt; Parsing Error: not well-formed&lt;br /&gt;Location: &lt;a href="http://localhost:3000/info/who_bought/48126371"&gt;http://localhost:3000/info/who_bought/48126371&lt;/a&gt;&lt;br /&gt;Line Number 1, Column 15:&lt;br /&gt;xml.order_list(:for_product =&amp;gt; @product.title) do&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;What am I doing wrong here.&lt;/p&gt;</description>
      <pubDate>Tue, 04 Mar 2008 20:04:32 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:291:2375</guid>
      <author>Tony Bianco</author>
      <link>http://forums.pragprog.com/forums/22/topics/291</link>
    </item>
  </channel>
</rss>
