Innovative XML solutions since 2003

ExamXML  MDCXML  JExamXML  xml2csv  csv2xml 
Supports complicated XML structure by using aliases
XML2CSV allows you to convert a very sophisticated XML document to a CSV file. To extract data from complicated XML structure you should just specify aliases in the field's file. Each alias contains the full name of the element or the attribute to be extracted. The full name of the element contains names of all ancestors beginning with the name of the root element.
<orders>
  <order>
    <seller><fname>Jose</fname></seller>
    <buyer><fname>Carlos</fname></buyer>
    <assistant fname="Bill" id="2"/>
    <assistant fname="Scott" id="3"/>
  </order>
.......
and resulting CSV string should be:
Jose, Carlos, Bill, Scott
You should specify aliases in the fields file.
seller, buyer, assistant_1, assistant_2
seller = orders>order>seller>fname
buyer = orders>order>buyer>fname
assistant_1 = orders>order>assistant|fname
assistant_2 = orders>order>assistant|fname
Common attributes and elements can be inserted into each row
Suppose there are some elements or attributes that you want to insert into each row of the csv file.
<orders>
 <client>ABCD</client>
 <order type="FOB">
   <title>ZUT56</title>
   <item name="HETZ" price="34.00" />
   <item name="MJFH" price="20.00" />
   <item name="HFZG" price="10.70" />
   <item name="IKRG" price="25.90" />
 </order>
 <order type="FIS">
   <item name="HETZ" price="34.00" />
   <item name="MJFH" price="20.00" />
   <item name="HFZG" price="10.70" />
   <item name="IKRG" price="25.90" />
 </order>
</orders>

and a csv file you want to be:
client,type,title,name,price
"ABCD","FOB","ZUT56","HETZ","34.00"
"ABCD","FOB","ZUT56","MJFH","20.00"
"ABCD","FOB","ZUT56","HFZG","10.70"
"ABCD","FOB","ZUT56","IKRG","25.90"
"ABCD","FIS","","HETZ","34.00"
"ABCD","FIS","","MJFH","20.00"
"ABCD","FIS","","HFZG","10.70"
"ABCD","FIS","","IKRG","25.90"

The "type" alias as a common attribute and the "client" element as a common element specified by using "==" instead of "=".
The "title" alias is a common element within parent element scope
("=*" instead of "==").

client,type,title,name,price    # common element
client == orders>client           # common attribute
type   == orders>order|type   # common element within element scope
title    =* orders>order>title
name  =  orders>order>item|name
price   =  orders>order>item|price