title: Can't read from XML file in S3 with Python
body: <p>I have an XML file sitting in S3 and I need to open it from a lambda function and write strings to a DynamoDB table. I am using <code>etree</code> to parse the file. However, I don't think any content is actually getting read from the file. Below is my code, the error, and some sample xml. </p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import boto3
  import lxml
  from lxml import etree
  
  def lambda_handler(event, context):
      output = 'Lambda ran successfully!'
      return output
  
  def WriteItemToTable():
      s3 = boto3.resource('s3')
  
      obj = s3.Object('bucket', 'object')
      body = obj.get()['Body'].read()
  
      image_id = etree.fromstring(body.content).find('.//IMAGE_ID').text
      print(image_id)
  
  
  WriteItemToTable()
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>'str' object has no attribute 'content'
  </code></pre>
  
  <p><strong>XML:</strong></p>
  
  <pre><code> &lt;HOST_LIST&gt;
      &lt;HOST&gt;
        &lt;IP network_id="X"&gt;IP&lt;/IP&gt;
        &lt;TRACKING_METHOD&gt;EC2&lt;/TRACKING_METHOD&gt;
        &lt;DNS&gt;&lt;![CDATA[i-xxxxxxxxxx]]&gt;&lt;/DNS&gt;
        &lt;EC2_INSTANCE_ID&gt;&lt;![CDATA[i-xxxxxxxxx]]&gt;&lt;/EC2_INSTANCE_ID&gt;
        &lt;EC2_INFO&gt;
          &lt;PUBLIC_DNS_NAME&gt;&lt;![CDATA[xxxxxxxxxxxx]]&gt;&lt;/PUBLIC_DNS_NAME&gt;
          &lt;IMAGE_ID&gt;&lt;![CDATA[ami-xxxxxxx]]&gt;&lt;/IMAGE_ID&gt;
  </code></pre>
  
  <p>I am trying to pull the AMI ID inside of the <code>&lt;IMAGE_ID&gt;</code> tag. </p>