title: Python Scrapy customize the crawl items xml format
body: <p>I using scrapy to crawl a webpage and I want the output to xml file in certain format, below are my code.</p>
  
  <p>Item class</p>
  
  <pre><code>class Item(Item):
  # define the fields for your item here like:
      id = Field()
      name = Field()
      address = Field()
      birthdate = Field()
      review = Field()
  </code></pre>
  
  <p>Spider class</p>
  
  <pre><code>class FriendSpider(BaseSpider):
  # identifies of the Spider
  name = "friend"
  count = 0 
  allowed_domains = ["example.com.us"]
  start_urls = [
      "http://example.com.us/biz/friendlist/"
  ]
  def start_requests(self):
      for i in range(0,1722,40):
          yield self.make_requests_from_url("http://example.com.us/biz/friendlist/?start=%d" % i)
  
  def parse(self, response):
  
      response = response.replace(body=response.body.replace('&lt;br /&gt;', '\n')) 
      hxs = HtmlXPathSelector(response)
      sites = hxs.select('//ul/li')
      items = []
  
      for site in sites:
          item = Item()
          self.count += 1
          item['id'] = str(self.count)
          item['name'] = site.select('.//div/div/h4/text()').extract()
          item['address'] = site.select('h4/span/text()').extract()
          item['review'] = ''.join(site.select('.//div[@class="review"]/p/text()').extract())
          item['birthdate'] = site.select('.//div/div/h5/text()').extract()
  
          items.append(item)
      return items
  </code></pre>
  
  <p>The output was in this format:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;items&gt;
    &lt;item&gt;
       &lt;id&gt;1&lt;/id&gt;
       &lt;name&gt;&lt;value&gt;Keith&lt;/value&gt;&lt;/name&gt;
       &lt;review&gt;txt............&lt;/review&gt;
       &lt;address&gt;&lt;value&gt;United States&lt;/value&gt;&lt;/address&gt;
       &lt;birthdate&gt;&lt;value&gt;1988-04-03&lt;/value&gt;&lt;/birthdate&gt;
    &lt;/item&gt;
    .....
  &lt;items&gt;
  </code></pre>
  
  <p>How can I customize the xml format to below: remove the value tag and move the id to item root.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;items&gt;
    &lt;friend id = "1"&gt;
       &lt;name&gt;Keith&lt;/name&gt;
       &lt;review&gt;txt............&lt;/review&gt;
       &lt;address&gt;United States&lt;/address&gt;
       &lt;birthdate&gt;1988-04-03&lt;/birthdate&gt;
    &lt;/friend&gt;
    .....
  &lt;items&gt;
  </code></pre>