title: How to query XML column in Postgresql?
body: <p>I've created a table in Postgres that contains an XML column:</p>
  
  <pre><code> id           | integer
   date_created | timestamp with time zone
   hash         | character varying(10)
   original     | xml
   report_name  | text
  </code></pre>
  
  <p>I've inserted an XML string:</p>
  
  <pre><code>id |         date_created          |    hash    |                                 original                                 |               report_name                
  ----+-------------------------------+------------+--------------------------------------------------------------------------+------------------------------------------
    9 | 2017-09-26 17:37:16.823251+02 | aaaaaaaaaa | &lt;RequestReportResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/"&gt;+| _GET_XML_ALL_ORDERS_DATA_BY_LAST_UPDATE_
      |                               |            |   &lt;RequestReportResult&gt;                                                 +| 
      |                               |            |     &lt;ReportRequestInfo&gt;                                                 +| 
      |                               |            |       &lt;ReportType&gt;_GET_XML_ALL_ORDERS_DATA_BY_LAST_UPDATE_&lt;/ReportType&gt; +| 
      |                               |            |       &lt;ReportProcessingStatus&gt;_SUBMITTED_&lt;/ReportProcessingStatus&gt;      +| 
      |                               |            |       &lt;EndDate&gt;2017-09-26T13:31:02+00:00&lt;/EndDate&gt;                      +| 
      |                               |            |       &lt;Scheduled&gt;false&lt;/Scheduled&gt;                                      +| 
      |                               |            |       &lt;ReportRequestId&gt;50064017435&lt;/ReportRequestId&gt;                    +| 
      |                               |            |       &lt;SubmittedDate&gt;2017-09-26T13:31:02+00:00&lt;/SubmittedDate&gt;          +| 
      |                               |            |       &lt;StartDate&gt;2017-09-26T13:31:02+00:00&lt;/StartDate&gt;                  +| 
      |                               |            |     &lt;/ReportRequestInfo&gt;                                                +| 
      |                               |            |   &lt;/RequestReportResult&gt;                                                +| 
      |                               |            |   &lt;ResponseMetadata&gt;                                                    +| 
      |                               |            |     &lt;RequestId&gt;e092cdbe-2978-4064-a5f6-129b88322b02&lt;/RequestId&gt;         +| 
      |                               |            |   &lt;/ResponseMetadata&gt;                                                   +| 
      |                               |            | &lt;/RequestReportResponse&gt;                                                +| 
      |                               |            |                                                                          |
  </code></pre>
  
  <p>Using the same XML in an <a href="https://www.freeformatter.com/xpath-tester.html#ad-output" rel="noreferrer">online</a> XPath tester I am able to retrieve the value in <code>ReportRequestId</code> but when querying Postgresql I get no values back:</p>
  
  <pre><code>select xpath('/RequestReportResponse/RequestReportResult/ReportRequestInfo/ReportRequestId', original) from amazon_output where hash='aaaaaaaaaa';
  </code></pre>
  
  <p>What am I missing with the XML data type?</p>