title: How to load xml file into Hive
body: <p>Im working on Hive tables im having the following problem. I am having more than 1 billion of xml files in my HDFS. What i want to do is, Each xml file having the  4 different sections. Now i want to split and load the each part in the each table for every xml file </p>
  
  <p>Example : </p>
  
  <pre><code>            &lt;?xml version='1.0' encoding='iso-8859-1'?&gt;
  
              &lt;section1&gt;
                  &lt;id&gt; 1233222 &lt;/id&gt;
                 // having lot of xml tages 
              &lt;/section1&gt;
  
              &lt;section2&gt;
                 // having lot of xml tages 
              &lt;/section2&gt;
  
              &lt;section3&gt;
                 // having lot of xml tages 
              &lt;/section3&gt;
  
              &lt;section4&gt;
                 // having lot of xml tages 
              &lt;/section4&gt;
  
              &lt;/xml&gt;
  </code></pre>
  
  <p>And i have the four tables </p>
  
  <pre><code>        section1Table
  
          id       section1    // fields 
  
          section2Table
  
          id       section2
  
          section3Table 
  
          id       section3
  
          section4Table
  
          id       section4
  </code></pre>
  
  <p>Now i want to split and load the data into each table. </p>
  
  <p>How can i achieve this . Can anyone help me </p>
  
  <p>Thanks </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have tried the following </p>
  
  <pre><code>CREATE EXTERNAL TABLE test(name STRING) LOCATION '/user/sornalingam/zipped/output/Tagged/t1';\
  
  
  SELECT xpath (name, '//section1') FROM test LIMIT 1 ;
  </code></pre>
  
  <p>but i got the following error </p>
  
  <pre><code>java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"name":"&lt;?xml version='1.0' encoding='iso-8859-1'?&gt;"}
  </code></pre>