Good day.!
I am getting stuck with parsing my xml data in order for me to display it on a listview. The xml data to be parsed is not constant. The the <NumRows> is changing. I need .bas or any other function in VB6 that will parse the xml and display the data in the listview base on <ReportData> contents. The <TitleRow> of the xml data will be the header of the listview and the data of this row will have the <value> of the colID equal to the colID of the Header or the <titileRow> and the <ReportData>.Below is the sample xml with a file named sample.xml.
<?xml version="1.0" ?>
- <QBXML>
- <QBXMLMsgsRs>
- <GeneralDetailReportQueryRs requestID="0" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
- <ReportRet>
<ReportTitle>Customer Balance Detail</ReportTitle>
<ReportSubtitle>All Transactions</ReportSubtitle>
<ReportBasis>Accrual</ReportBasis>
<NumRows>4</NumRows>
<NumColumns>8</NumColumns>
<NumColTitleRows>1</NumColTitleRows>
- <ColDesc colID="1" dataType="STRTYPE">
<ColTitle titleRow="1" />
<ColType>Blank</ColType>
</ColDesc>
- <ColDesc colID="2" dataType="DATETYPE">
<ColTitle titleRow="1" value="Date" />
<ColType>Date</ColType>
</ColDesc>
- <ColDesc colID="3" dataType="STRTYPE">
<ColTitle titleRow="1" value="Memo" />
<ColType>Memo</ColType>
</ColDesc>
- <ColDesc colID="4" dataType="STRTYPE">
<ColTitle titleRow="1" value="Num" />
<ColType>RefNumber</ColType>
</ColDesc>
- <ColDesc colID="5" dataType="INTTYPE">
<ColTitle titleRow="1" value="Trans #" />
<ColType>TxnNumber</ColType>
</ColDesc>
- <ColDesc colID="6" dataType="AMTTYPE">
<ColTitle titleRow="1" value="Debit" />
<ColType>Debit</ColType>
</ColDesc>
- <ColDesc colID="7" dataType="AMTTYPE">
<ColTitle titleRow="1" value="Credit" />
<ColType>Credit</ColType>
</ColDesc>
- <ColDesc colID="8" dataType="AMTTYPE">
<ColTitle titleRow="1" value="Balance" />
<ColType>RunningBalance</ColType>
</ColDesc>
- <ReportData>
<TextRow rowNumber="1" value="Piamonte, Rodrigo Jr." />
- <DataRow rowNumber="2">
<RowData rowType="name" value="Piamonte, Rodrigo Jr." />
<ColData colID="2" value="2009-04-03" />
<ColData colID="3" value="# or 18756" />
<ColData colID="5" value="33885" />
<ColData colID="7" value="8.00" />
<ColData colID="8" value="8.00" />
</DataRow>
- <DataRow rowNumber="3">
<RowData rowType="name" value="Piamonte, Rodrigo Jr." />
<ColData colID="2" value="2009-04-07" />
<ColData colID="4" value="1141" />
<ColData colID="5" value="33944" />
<ColData colID="6" value="2500.00" />
<ColData colID="8" value="-2492.00" />
</DataRow>
- <DataRow rowNumber="4">
<RowData rowType="name" value="Piamonte, Rodrigo Jr." />
<ColData colID="2" value="2009-04-08" />
<ColData colID="3" value="swf 114w" />
<ColData colID="4" value="1142" />
<ColData colID="5" value="33947" />
<ColData colID="6" value="2000.00" />
<ColData colID="8" value="-4492.00" />
</DataRow>
</TotalRow>
</ReportData>
</ReportRet>
</GeneralDetailReportQueryRs>
</QBXMLMsgsRs>
</QBXML>
Aby help will be greatly appreciated. God bless us and Thank you for your time.