0

Below is a part of a list that looks like following:

$item_data
<item_data>
  <item_basic_data>
    <item_unique_id>B003U8EMDA</item_unique_id>
    <item_sku>B003U8EMDA</item_sku>
    <parent_asin>B003U8EMDA</parent_asin>
    <item_upc>885480182565</item_upc>
    <item_mpn>GZDY019-264</item_mpn>
    <item_brand>SIB</item_brand>
    <item_name>Laptop AC Adapter/Power Supply/Charger+US Power Cord for Dell Studio 1435 1450 1457 14z 15 1536 1537 1555 1557 17 1735 1736 1737 1745 1747 PP33L pp31l</item_name>
    <item_model>GZDY019-264</item_model>
    <item_category>Personal Computer</item_category>
    <item_short_desc>&lt;br&gt;DC-Output : 19.5V-4.62A-90W - Input : 100-240V 1.5A 50/60 Hz&lt;br&gt;Package Includes : One AC Adapter and One US Power Cord for Listed Models&lt;br&gt;100% OEM compatible&lt;br&gt;This Product has 12 MONTHS REPLACEMENT WARRANTY</item_short_desc>
    <item_page_url>http://www.amazon.in/dp/B003U8EMDA/ref=asc_df_B003U8EMDA33161676/?tag=ihre_partner_id&amp;creative=165953&amp;creativeASIN=B003U8EMDA&amp;linkCode=df0</item_page_url>
    <amzn_page_url>http://www.amazon.in/dp/B003U8EMDA/ref=asc_df_B003U8EMDA33161676/?tag=ihre_partner_id&amp;creative=165953&amp;creativeASIN=B003U8EMDA&amp;linkCode=df0</amzn_page_url>
    <fm_page_url>http://www.amazon.in/dp/B003U8EMDA/ref=asc_df_B003U8EMDA33161676?smid=A1JV1LN0Y6K86J&amp;tag=ihre_partner_id&amp;linkCode=df0&amp;creative=165953&amp;creativeASIN=B003U8EMDA</fm_page_url>
    <offer_page_url>http://www.amazon.in/gp/offer-listing/B003U8EMDA/ref=asc_df_B003U8EMDA33161676?ie=UTF8&amp;condition=new&amp;tag=ihre_partner_id&amp;creative=165953&amp;creativeASIN=B003U8EMDA&amp;linkCode=df2</offer_page_url>
    <offer_used_url>http://www.amazon.in/gp/offer-listing/B003U8EMDA/ref=asc_df_B003U8EMDA33161676?ie=UTF8&amp;condition=used&amp;tag=ihre_partner_id&amp;creative=165953&amp;creativeASIN=B003U8EMDA&amp;linkCode=df2</offer_used_url>
    <tp_fba_url/>
    <item_image_url>http://ecx.images-amazon.com/images/I/51v8FxFP56L._SL160_.jpg</item_image_url>
    <item_image_url_small>http://ecx.images-amazon.com/images/I/51v8FxFP56L._SL75_.jpg</item_image_url_small>
    <item_image_url_large>http://ecx.images-amazon.com/images/I/51v8FxFP56L.jpg</item_image_url_large>
    <item_salesrank>6039</item_salesrank>
    <item_price>1263.00</item_price>
    <item_inventory>Usually dispatched within 6-10 business days</item_inventory>
    <item_shipping_charge>0.00</item_shipping_charge>
    <item_merchant_id>A1JV1LN0Y6K86J</item_merchant_id>
    <fm_price>1263.00</fm_price>
    <fm_inventory>Usually dispatched within 6-10 business days</fm_inventory>
    <fm_shipping_charge>0.00</fm_shipping_charge>
    <fm_merchant_id>A1JV1LN0Y6K86J</fm_merchant_id>
    <tp_new_price>1263.00</tp_new_price>
    <tp_new_inventory>Usually dispatched within 6-10 business days</tp_new_inventory>
    <tp_new_shipping_charge>0.00</tp_new_shipping_charge>
    <tp_new_merchant_id>A1JV1LN0Y6K86J</tp_new_merchant_id>
  </item_basic_data>
  <merch_cat_list>
    <merch_cat_item>
      <merch_cat_name>1375310031</merch_cat_name>
      <merch_cat_path>Computers &amp; Accessories/Categories/Accessories/Laptop Accessories/Chargers &amp; Power Supplies</merch_cat_path>
    </merch_cat_item>
  </merch_cat_list>
</item_data> 

Now, I need only the data that has come between < >, example, item_unique_id has come between . Is there a way that we can extract & store it in a data frame?

Results Expexted

need to extract header as shown below in a data frame , just the headers

item_unique_id      item_sku       parent_asin    item_upc     item_mpn

Note: The class of the above code is "XMLInternalNodeList" "XMLNodeList"

  • This question is unclear. Please add an example bit of the output that you would like into your question, for example a data.frame containing the first 10 items you would like to extract. In addition, what have you tried already? – lmo Apr 13 '16 at 12:52
  • duplicate of http://stackoverflow.com/questions/13498843/regex-to-pickout-some-text-between-parenthesis or http://stackoverflow.com/questions/26809847/extract-text-between-certain-symbols-using-regular-expression-in-r – Roman Apr 13 '16 at 12:52

0 Answers0