title: How to parse an XML document with Nokogiri
body: <p>I am trying to parse an XML file using Nokogiri in Ruby on Rails:</p>
  
  <pre><code>&lt;ItemID&gt;
      &lt;SupplierPartID&gt;GH-CF-BINDER&lt;/SupplierPartID&gt;
    &lt;/ItemID&gt;
    &lt;ItemDetail&gt;
      &lt;UnitPrice&gt;&lt;Money currency="USD"&gt;&lt;/Money&gt;&lt;/UnitPrice&gt;
      &lt;Description xml:lang="en"&gt;Ghent Contract Furniture Binder&lt;/Description&gt;
      &lt;UnitOfMeasure&gt;Each&lt;/UnitOfMeasure&gt;
      &lt;Classification domain=""&gt;&lt;/Classification&gt;
      &lt;Extrinsic name="tag"&gt;GH-CF-BINDER&lt;/Extrinsic&gt;
      &lt;Extrinsic name="bin_number"&gt;103/18/9&lt;/Extrinsic&gt;
      &lt;Extrinsic name="billing email"&gt;&lt;/Extrinsic&gt; 
      &lt;Extrinsic name="bill_code6"&gt;&lt;/Extrinsic&gt; 
      &lt;Extrinsic name="prodcode"&gt;&lt;/Extrinsic&gt;
      &lt;Extrinsic name="stock_tag"&gt;&lt;/Extrinsic&gt; 
      &lt;Extrinsic name="has_imprint"&gt;N&lt;/Extrinsic&gt; 
      &lt;Extrinsic name="manuf_id"&gt;4117&lt;/Extrinsic&gt;
      &lt;Extrinsic name="bill_code1"&gt;&lt;/Extrinsic&gt;
  
    &lt;/ItemDetail&gt;
  </code></pre>
  
  <p>When I try to parse, instead of receiving a blank value for some blank fields, it instead returns the "name => bill_code1" (for example).</p>
  
  <p>So far my solution is like this but every XML file is slightly different in the layout of the extrinsic tags:</p>
  
  <pre><code>item_info_params['extrinsic_tag'] = item_info_to_xml['ItemOut']['ItemDetail']['Extrinsic']
  
  #expands from the above param extrinsic_tag because there is 10 elemenets in it
  item_info_params['tag'] = item_info_params['extrinsic_tag'][0]
  item_info_params['price'] = item_info_params['extrinsic_tag'][1]
  item_info_params['bin_number'] = item_info_params['extrinsic_tag'][2]
  item_info_params['requested_delivery'] = item_info_params['extrinsic_tag'][3]
  item_info_params['billing_email'] = item_info_params['extrinsic_tag'][4]
  item_info_params['bill_code6'] = item_info_params['extrinsic_tag'][5]
  item_info_params['prodcode'] = item_info_params['extrinsic_tag'][6]
  item_info_params['stock_tag'] = item_info_params['extrinsic_tag'][7]
  item_info_params['has_imprint'] = item_info_params['extrinsic_tag'][8]
  item_info_params['manuf_id'] = item_info_params['extrinsic_tag'][9]
  item_info_params['bill_code1'] = item_info_params['extrinsic_tag'][10]
  item_info_params['order_id'] = order.id
  
  customer = Customer.create(item_info_params)
  </code></pre>
  
  <p>So, as stated above, <code>item_info_params['bill_code1']</code> will be assigned to <code>name =&gt; bill_code1</code> instead of a blank value. </p>
  
  <p>It's confusing how to solve this problem. </p>