LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help me convert this xml file to csv (https://www.linuxquestions.org/questions/linux-software-2/help-me-convert-this-xml-file-to-csv-4175508743/)

xmrkite 06-21-2014 05:24 PM

Help me convert this xml file to csv
 
I want to convert our yahoo store xml feed to csv for easy manipulation.

Here is a sample of the file:

Code:

<Item ID="7302ss-24s" TableID="item.">
    <ItemField TableFieldID="description" Value=""/>
    <ItemField TableFieldID="option-9-name" Value=""/>
    <ItemField TableFieldID="name" Value="Sterling Silver St. Bede the Venerable Pendant, Stainless Silver Heavy Curb Chain, Large Size Catholic Medal, 1&quot; x 3/4&quot;"/>
    <ItemField TableFieldID="option-7-code" Value=""/>
    <ItemField TableFieldID="download" Value=""/>
    <ItemField TableFieldID="abstract" Value=""/>
    <ItemField TableFieldID="label" Value=""/>
    <ItemField TableFieldID="option-8-name" Value=""/>
    <ItemField TableFieldID="option-6-code" Value=""/>
    <ItemField TableFieldID="orderable" Value="t"/>
    <ItemField TableFieldID="product-url" Value="http://www.catholicfreeshipping.com/7302ss-24s.html"/>
    <ItemField TableFieldID="option-7-price" Value=""/>
    <ItemField TableFieldID="taxable" Value="t"/>
    <ItemField TableFieldID="availability" Value="Usually ships the same business day"/>
    <ItemField TableFieldID="option-5-code" Value=""/>
    <ItemField TableFieldID="option-7-name" Value=""/>
    <ItemField TableFieldID="headline" Value=""/>
    <ItemField TableFieldID="option-4-code" Value=""/>
    <ItemField TableFieldID="option-6-name" Value=""/>
    <ItemField TableFieldID="keywords" Value=""/>
    <ItemField TableFieldID="inset" Value=""/>
    <ItemField TableFieldID="option-2-price" Value=""/>
    <ItemField TableFieldID="option-5-name" Value=""/>
    <ItemField TableFieldID="code" Value="7302SS-24S"/>
    <ItemField TableFieldID="option-3-code" Value=""/>
    <ItemField TableFieldID="option-2-code" Value=""/>
    <ItemField TableFieldID="option-4-name" Value=""/>
    <ItemField TableFieldID="option-9-price" Value=""/>
    <ItemField TableFieldID="code-is-isbn" Value=""/>
    <ItemField TableFieldID="option-3-name" Value=""/>
    <ItemField TableFieldID="option-2-name" Value=""/>
    <ItemField TableFieldID="option-4-price" Value=""/>
    <ItemField TableFieldID="option-10-price" Value=""/>
    <ItemField TableFieldID="icon" Value=""/>
    <ItemField TableFieldID="code-is-upc" Value="t"/>
    <ItemField TableFieldID="caption" Value="Sterling Silver St. Bede the Venerable Pendant, Stainless Silver Heavy Curb Chain, Large Size Catholic Medal, 1&quot; x 3/4&quot; &lt;br&gt;&lt;br&gt;&lt;p&gt;&lt;img border=&quot;0&quot; src=&quot;http://site.catholicfreeshipping.com/blissimg.jpg&quot; width=&quot;600&quot; height=&quot;823&quot;&gt;&lt;/p&gt;Engraving is available for large and medium medals only. &lt;br&gt;Engraving is available up to 4 lines 16 Letters each on the large medals and up to 3 lines 12 Letters each on medium medals. Available Type Fonts: Roman, Helvetica, Script, Mongram, &amp; Monogram Circle. Monogram Fonts are limited to three letters. Add words to be engraved at checkout in comments box.&lt;br&gt;&lt;br&gt;Bliss Manufacturing, a more than 100-year-old, family-owned company, makes all of its jewelry in the U.S.A. They currently offer more than 450 different Patron Saint medals.&lt;br&gt;&lt;br&gt;All Bliss jewelry is die-struck, the same way the U.S. Mint makes coins, which produces rich detail. Each Bliss medal carries a Lifetime Warranty. If for whatever reason a Bliss medal shall become tarnished, Bliss will either re-finish or replace the medal free of charge."/>
    <ItemField TableFieldID="code-is-sku" Value=""/>
    <ItemField TableFieldID="option-6-price" Value=""/>
    <ItemField TableFieldID="condition" Value="New"/>
    <ItemField TableFieldID="sale-price" Value=""/>
    <ItemField TableFieldID="option-8-price" Value=""/>
    <ItemField TableFieldID="option-11-code" Value=""/>
    <ItemField TableFieldID="option-10-code" Value=""/>
    <ItemFieldOptions TableFieldID="options">
      <Option Key="Personalized Engraving">
        <OptionValue Value="No Thank You"/>
        <OptionValue Value="Yes Please Engrave My Medal (+15.00)"/>
      </Option>
    </ItemFieldOptions>
    <ItemField TableFieldID="option-11-name" Value=""/>
    <ItemField TableFieldID="option-3-price" Value=""/>
    <ItemField TableFieldID="option-10-name" Value=""/>
    <ItemField TableFieldID="image" Value="&lt;img border=0 width=406 height=500 src=http://ep.yimg.com/ca/I/catholicfreeshipping_2270_224738098&gt;"/>
    <ItemField TableFieldID="ship-weight" Value=""/>
    <ItemField TableFieldID="page-title" Value=""/>
    <ItemField TableFieldID="gift-certificate" Value=""/>
    <ItemField TableFieldID="option-9-code" Value=""/>
    <ItemField TableFieldID="price" Value="53.5"/>
    <ItemField TableFieldID="option-5-price" Value=""/>
    <ItemField TableFieldID="option-11-price" Value=""/>
    <ItemField TableFieldID="option-8-code" Value=""/>
  </Item>

Any idea of how to use xmlstarlet to get this done?

John VV 06-21-2014 06:04 PM

use a spreadsheet

xmrkite 06-21-2014 09:48 PM

ok, but what would I do??? How could a "spreadsheet" convert this over to xml?


All times are GMT -5. The time now is 05:09 AM.