[xml] Using the XML Parser to convert XML to CSV



Can anyone shed some on light on this for me?

I'm trying to convert an XML file, such as the sample below, to a CSV
file.

<BatchCSVUtilServlet>
<CSVUtil>
<Command>xcsv</Command>
<DataDir>/</DataDir>
<DataFileName>null</DataFileName>
<Write>
<Table>null</Table>
<WhereClause>null</WhereClause>
<DomainName>null</DomainName>
<Sql>SELECT SHIPMENT.SHIPMENT_GID, SHIPMENT.TOTAL_ACTUAL_COST FROM
SHIPMENT WHERE SHIPMENT.TOTAL_ACTUAL_COST > 300</Sql>
<SqlQuery>SELECT SHIPMENT.SHIPMENT_GID, SHIPMENT.TOTAL_ACTUAL_COST FROM
SHIPMENT WHERE SHIPMENT.TOTAL_ACTUAL_COST > 300</SqlQuery>
<ColumnList>SHIPMENT_GID,TOTAL_ACTUAL_COST</ColumnList>
<Row>"TESCO.72166",455</Row>
<Row>"TESCO.72181",352.569999999999936335370875895023345947</Row>
<Row>"TESCO.72186",860</Row>
</Write>
</CSVUtil>
</BatchCSVUtilServlet>

All I want to do is output data between the <COLUMNLIST>, <SQL>,
<SQLQUERY> and <ROW> elements to a file, having removed the tags first. 
Since the data is already in a suitable CSV format, that's all that
really needs to be done.

I've seen it done using python, but can't seem to re-create it in C/C++.

Any help would be greatly appreciated!

Thanks
Robert

--------------------------
Robert Reardon
<rreardon ntlworld com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]