Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import XML data File to VFP Database - please help

Status
Not open for further replies.

timmappa

Programmer
Jan 21, 2001
20
0
0
AU
I have received XML file. I have used XMLAdapter to import this file to VFP table - (possibly more than one table like customer details in one table & transaction details in another table). My program is not accepting this file & I don't know what is wrong. Received file sample as follows:

<?xml version="1.0"?>
<!--ALSCO XML Invoicing version 1.0-->
<Branch Code="ABC,MUL">
<CompanyName>ABC LTD</CompanyName>
<CompanyAddr1>A Division of XYZ</CompanyAddr1>
<CompanyAddr2>1-4 A B C Street</CompanyAddr2>
<CompanyAddr3>XYZC 9999</CompanyAddr3>
<CompanyAddr4/>
<CompanyPhone>(99) 9561 6977</CompanyPhone>
<CompanyFax>(99) 9561 6067</CompanyFax>
<CompanyEmail>XYZ@ABC.com.AD</CompanyEmail>
<CompanyABN>ABN: 12 000 999 333</CompanyABN>
<Invoice InvoiceNumber="CMUL25793" InvoiceType="TAX INVOICE / STATEMENT" IsStatement="true">
<InvoiceFormat>By Date/Invt</InvoiceFormat>
<InvoiceDate>31 Jul 2006</InvoiceDate>
<InvoiceLevel>Customer</InvoiceLevel>
<InvoiceFreq>Monthly</InvoiceFreq>
<SubTotal>60.00</SubTotal>
<Tax Type="GST">6.00</Tax>
<Total>66.00</Total>
<TeamName>A Pty Ltd</TeamName>
<TeamAddr1>A Division of XYZ LTD</TeamAddr1>
<TeamAddr2>41 Street</TeamAddr2>
<TeamAddr3>M XYZ 9999</TeamAddr3>
<TeamAddr4/>
<TeamPhone>(99) 23 6977</TeamPhone>
<TeamFax>(99) 24 6067</TeamFax>
<TeamEmail>aBC@XYZ.com.ad</TeamEmail>
<LocnNote/>
<ClntNote/>
<RouteNote/>
<BranchNote/>
<HeadOwingCurrent>214.50 </HeadOwingCurrent>
<HeadOwingOneMnth>82.50 </HeadOwingOneMnth>
<HeadOwingTwoMnth>66.00 </HeadOwingTwoMnth>
<HeadOwingThreeMnth>66.00 </HeadOwingThreeMnth>
<FootStatementTotal>214.50 </FootStatementTotal>
<FootCurrentBalance>66.00 </FootCurrentBalance>
<FootThirtyDayBalance>82.50 </FootThirtyDayBalance>
<FootOverdueBalance/>
<Client Code="003617">
<ClientDesc>Darrell Lea Chocolate Shop</ClientDesc>
<ClientHandlingCode/>
<FinancialCatg>LG2</FinancialCatg>
<Terms>Strictly 20th of Mnth</Terms>
<InvoiceAddr1>Darrell Lea Chocolate Shop</InvoiceAddr1>
<InvoiceAddr2>65 S Street</InvoiceAddr2>
<InvoiceAddr3>M VIC 3000</InvoiceAddr3>
<InvoiceAddr4/>
<InvoiceAddr5/>
<InvoiceAddr6/>
<InvoiceAddr7/>
<Postcode>3000</Postcode>
<Location Code="003617">
<LocationDesc>Darrell Lea Chocolate Shop</LocationDesc>
<DeliveryAddr1>Darrell Lea Chocolate Shop</DeliveryAddr1>
<DeliveryAddr2>65 S Street</DeliveryAddr2>
<DeliveryAddr3>M VIC 3000</DeliveryAddr3>
<DeliveryAddr4/>
<DeliveryAddr5/>
<Phone>9764 5379</Phone>
<Route>67</Route>
<Stop>360</Stop>
<Line>
<TranCode>DCNYD77-DY</TranCode>
<TranDesc>6x4 Mat Dustop, Dark Grey</TranDesc>
<Code>DCNYD77-DY</Code>
<Desc>6x4 Mat Dustop, Dark Grey</Desc>
<DelvDate>20060706</DelvDate>
<LineQuantity>1.00</LineQuantity>
<LineValue>12.55</LineValue>
<TranQuantity>1.00</TranQuantity>
<TranValue>12.55</TranValue>
<ChgQuantity>1.00</ChgQuantity>
<StkQuantity>1.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>1.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue>125.5000</ReplaceValue>
<FullRentValue>12.5500</FullRentValue>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit>Each</Unit>
<AlsUnit>06/07/06</AlsUnit>
<UnitPrice>12.5500</UnitPrice>
<CountProcess/>
<CstkLineNumber>0010</CstkLineNumber>
<CstkContMin>1</CstkContMin>
<CstkQtySte>1.00</CstkQtySte>
<CstkQtySts>1.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2>DLDK14022</Wearer2>
<WearerName/>
<LineType>Plnt</LineType>
<TranSrce>P</TranSrce>
<TranType>CSTK</TranType>
<TranType2>CSTK</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>true</IsDelvDckt>
<DelvDocket>DLDK14022</DelvDocket>
<TranService>Delivery</TranService>
<TranInvoiceRule/>
<CstkInvoiceRule01>EPUMINDQ</CstkInvoiceRule01>
<CstkInvrPrcsSeq01/>
<CstkInvrITXT01/>
<CstkInvrChgTxt/>
<CstkInvrShort>DQ</CstkInvrShort>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT/>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>DCNYD77-DY</RepCode>
</Line>
<Line>
<TranCode>LOCMINDLV</TranCode>
<TranDesc>Location Delivery minimum - 06 Jul 2006</TranDesc>
<Code>LOCMINDLV</Code>
<Desc>Location Delivery minimum - 06 Jul 2006</Desc>
<DelvDate>20060706</DelvDate>
<LineQuantity>0.00</LineQuantity>
<LineValue>2.45</LineValue>
<TranQuantity>0.00</TranQuantity>
<TranValue>2.45</TranValue>
<ChgQuantity>0.00</ChgQuantity>
<StkQuantity>0.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>0.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue/>
<FullRentValue/>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit/>
<AlsUnit>06/07/06</AlsUnit>
<UnitPrice>2.4500</UnitPrice>
<CountProcess/>
<CstkLineNumber>99999</CstkLineNumber>
<CstkContMin/>
<CstkQtySte>0.00</CstkQtySte>
<CstkQtySts>0.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2/>
<WearerName/>
<LineType>Invr</LineType>
<TranSrce>A</TranSrce>
<TranType>INVR</TranType>
<TranType2>INVR</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>false</IsDelvDckt>
<DelvDocket>DLDK14022</DelvDocket>
<TranService/>
<TranInvoiceRule>LOCMINDLV</TranInvoiceRule>
<TranInvrPrcsSeq>9995</TranInvrPrcsSeq>
<TranInvrITXT>Location Delivery minimum</TranInvrITXT>
<TranInvrChgTxt/>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT>Location Delivery minimum</TranITXT>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>LOCMINDLV</RepCode>
</Line>
<Line>
<TranCode>DCNYD77-DY</TranCode>
<TranDesc>6x4 Mat Dustop, Dark Grey</TranDesc>
<Code>DCNYD77-DY</Code>
<Desc>6x4 Mat Dustop, Dark Grey</Desc>
<DelvDate>20060713</DelvDate>
<LineQuantity>1.00</LineQuantity>
<LineValue>12.55</LineValue>
<TranQuantity>1.00</TranQuantity>
<TranValue>12.55</TranValue>
<ChgQuantity>1.00</ChgQuantity>
<StkQuantity>1.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>1.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue>125.5000</ReplaceValue>
<FullRentValue>12.5500</FullRentValue>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit>Each</Unit>
<AlsUnit>13/07/06</AlsUnit>
<UnitPrice>12.5500</UnitPrice>
<CountProcess/>
<CstkLineNumber>0010</CstkLineNumber>
<CstkContMin>1</CstkContMin>
<CstkQtySte>1.00</CstkQtySte>
<CstkQtySts>1.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2>DLDK14701</Wearer2>
<WearerName/>
<LineType>Plnt</LineType>
<TranSrce>P</TranSrce>
<TranType>CSTK</TranType>
<TranType2>CSTK</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>true</IsDelvDckt>
<DelvDocket>DLDK14701</DelvDocket>
<TranService>Delivery</TranService>
<TranInvoiceRule/>
<CstkInvoiceRule01>EPUMINDQ</CstkInvoiceRule01>
<CstkInvrPrcsSeq01/>
<CstkInvrITXT01/>
<CstkInvrChgTxt/>
<CstkInvrShort>DQ</CstkInvrShort>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT/>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>DCNYD77-DY</RepCode>
</Line>
<Line>
<TranCode>LOCMINDLV</TranCode>
<TranDesc>Location Delivery minimum - 13 Jul 2006</TranDesc>
<Code>LOCMINDLV</Code>
<Desc>Location Delivery minimum - 13 Jul 2006</Desc>
<DelvDate>20060713</DelvDate>
<LineQuantity>0.00</LineQuantity>
<LineValue>2.45</LineValue>
<TranQuantity>0.00</TranQuantity>
<TranValue>2.45</TranValue>
<ChgQuantity>0.00</ChgQuantity>
<StkQuantity>0.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>0.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue/>
<FullRentValue/>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit/>
<AlsUnit>13/07/06</AlsUnit>
<UnitPrice>2.4500</UnitPrice>
<CountProcess/>
<CstkLineNumber>99999</CstkLineNumber>
<CstkContMin/>
<CstkQtySte>0.00</CstkQtySte>
<CstkQtySts>0.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2/>
<WearerName/>
<LineType>Invr</LineType>
<TranSrce>A</TranSrce>
<TranType>INVR</TranType>
<TranType2>INVR</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>false</IsDelvDckt>
<DelvDocket>DLDK14701</DelvDocket>
<TranService/>
<TranInvoiceRule>LOCMINDLV</TranInvoiceRule>
<TranInvrPrcsSeq>9995</TranInvrPrcsSeq>
<TranInvrITXT>Location Delivery minimum</TranInvrITXT>
<TranInvrChgTxt/>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT>Location Delivery minimum</TranITXT>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>LOCMINDLV</RepCode>
</Line>
<Line>
<TranCode>DCNYD77-DY</TranCode>
<TranDesc>6x4 Mat Dustop, Dark Grey</TranDesc>
<Code>DCNYD77-DY</Code>
<Desc>6x4 Mat Dustop, Dark Grey</Desc>
<DelvDate>20060720</DelvDate>
<LineQuantity>1.00</LineQuantity>
<LineValue>12.55</LineValue>
<TranQuantity>1.00</TranQuantity>
<TranValue>12.55</TranValue>
<ChgQuantity>1.00</ChgQuantity>
<StkQuantity>1.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>1.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue>125.5000</ReplaceValue>
<FullRentValue>12.5500</FullRentValue>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit>Each</Unit>
<AlsUnit>20/07/06</AlsUnit>
<UnitPrice>12.5500</UnitPrice>
<CountProcess/>
<CstkLineNumber>0010</CstkLineNumber>
<CstkContMin>1</CstkContMin>
<CstkQtySte>1.00</CstkQtySte>
<CstkQtySts>1.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2>DLDK15417</Wearer2>
<WearerName/>
<LineType>Plnt</LineType>
<TranSrce>P</TranSrce>
<TranType>CSTK</TranType>
<TranType2>CSTK</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>true</IsDelvDckt>
<DelvDocket>DLDK15417</DelvDocket>
<TranService>Delivery</TranService>
<TranInvoiceRule/>
<CstkInvoiceRule01>EPUMINDQ</CstkInvoiceRule01>
<CstkInvrPrcsSeq01/>
<CstkInvrITXT01/>
<CstkInvrChgTxt/>
<CstkInvrShort>DQ</CstkInvrShort>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT/>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>DCNYD77-DY</RepCode>
</Line>
<Line>
<TranCode>LOCMINDLV</TranCode>
<TranDesc>Location Delivery minimum - 20 Jul 2006</TranDesc>
<Code>LOCMINDLV</Code>
<Desc>Location Delivery minimum - 20 Jul 2006</Desc>
<DelvDate>20060720</DelvDate>
<LineQuantity>0.00</LineQuantity>
<LineValue>2.45</LineValue>
<TranQuantity>0.00</TranQuantity>
<TranValue>2.45</TranValue>
<ChgQuantity>0.00</ChgQuantity>
<StkQuantity>0.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>0.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue/>
<FullRentValue/>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit/>
<AlsUnit>20/07/06</AlsUnit>
<UnitPrice>2.4500</UnitPrice>
<CountProcess/>
<CstkLineNumber>99999</CstkLineNumber>
<CstkContMin/>
<CstkQtySte>0.00</CstkQtySte>
<CstkQtySts>0.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2/>
<WearerName/>
<LineType>Invr</LineType>
<TranSrce>A</TranSrce>
<TranType>INVR</TranType>
<TranType2>INVR</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>false</IsDelvDckt>
<DelvDocket>DLDK15417</DelvDocket>
<TranService/>
<TranInvoiceRule>LOCMINDLV</TranInvoiceRule>
<TranInvrPrcsSeq>9995</TranInvrPrcsSeq>
<TranInvrITXT>Location Delivery minimum</TranInvrITXT>
<TranInvrChgTxt/>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT>Location Delivery minimum</TranITXT>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>LOCMINDLV</RepCode>
</Line>
<Line>
<TranCode>DCNYD77-DY</TranCode>
<TranDesc>6x4 Mat Dustop, Dark Grey</TranDesc>
<Code>DCNYD77-DY</Code>
<Desc>6x4 Mat Dustop, Dark Grey</Desc>
<DelvDate>20060727</DelvDate>
<LineQuantity>1.00</LineQuantity>
<LineValue>12.55</LineValue>
<TranQuantity>1.00</TranQuantity>
<TranValue>12.55</TranValue>
<ChgQuantity>1.00</ChgQuantity>
<StkQuantity>1.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>1.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue>125.5000</ReplaceValue>
<FullRentValue>12.5500</FullRentValue>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit>Each</Unit>
<AlsUnit>27/07/06</AlsUnit>
<UnitPrice>12.5500</UnitPrice>
<CountProcess/>
<CstkLineNumber>0010</CstkLineNumber>
<CstkContMin>1</CstkContMin>
<CstkQtySte>1.00</CstkQtySte>
<CstkQtySts>1.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2>DLDK16165</Wearer2>
<WearerName/>
<LineType>Plnt</LineType>
<TranSrce>P</TranSrce>
<TranType>CSTK</TranType>
<TranType2>CSTK</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>true</IsDelvDckt>
<DelvDocket>DLDK16165</DelvDocket>
<TranService>Delivery</TranService>
<TranInvoiceRule/>
<CstkInvoiceRule01>EPUMINDQ</CstkInvoiceRule01>
<CstkInvrPrcsSeq01/>
<CstkInvrITXT01/>
<CstkInvrChgTxt/>
<CstkInvrShort>DQ</CstkInvrShort>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT/>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>DCNYD77-DY</RepCode>
</Line>
<Line>
<TranCode>LOCMINDLV</TranCode>
<TranDesc>Location Delivery minimum - 27 Jul 2006</TranDesc>
<Code>LOCMINDLV</Code>
<Desc>Location Delivery minimum - 27 Jul 2006</Desc>
<DelvDate>20060727</DelvDate>
<LineQuantity>0.00</LineQuantity>
<LineValue>2.45</LineValue>
<TranQuantity>0.00</TranQuantity>
<TranValue>2.45</TranValue>
<ChgQuantity>0.00</ChgQuantity>
<StkQuantity>0.00</StkQuantity>
<LineQuantity>0.00</LineQuantity>
<DelvQuantity>0.00</DelvQuantity>
<RentQuantity>0.00</RentQuantity>
<RentValue>0.00</RentValue>
<RentUnitValue/>
<WashQuantity>0.00</WashQuantity>
<WashValue>0.00</WashValue>
<WashUnitValue/>
<LossQuantity>0.00</LossQuantity>
<LossValue>0.00</LossValue>
<AutolosQuantity>0.00</AutolosQuantity>
<AutolosValue>0.00</AutolosValue>
<AbuseQuantity>0.00</AbuseQuantity>
<AbuseValue>0.00</AbuseValue>
<ReplaceValue/>
<FullRentValue/>
<MINDPQuantity>0.00</MINDPQuantity>
<MINDPValue>0.00</MINDPValue>
<Unit/>
<AlsUnit>27/07/06</AlsUnit>
<UnitPrice>2.4500</UnitPrice>
<CountProcess/>
<CstkLineNumber>99999</CstkLineNumber>
<CstkContMin/>
<CstkQtySte>0.00</CstkQtySte>
<CstkQtySts>0.00</CstkQtySts>
<HasPlan>false</HasPlan>
<TranLocn>003617</TranLocn>
<TranLocnDesc>Darrell Lea Chocolate Shop</TranLocnDesc>
<Wearer/>
<Wearer2/>
<WearerName/>
<LineType>Invr</LineType>
<TranSrce>A</TranSrce>
<TranType>INVR</TranType>
<TranType2>INVR</TranType2>
<TranTaxType>Excl</TranTaxType>
<IsDelvDckt>false</IsDelvDckt>
<DelvDocket>DLDK16165</DelvDocket>
<TranService/>
<TranInvoiceRule>LOCMINDLV</TranInvoiceRule>
<TranInvrPrcsSeq>9995</TranInvrPrcsSeq>
<TranInvrITXT>Location Delivery minimum</TranInvrITXT>
<TranInvrChgTxt/>
<CstkInvrPcntMin>false</CstkInvrPcntMin>
<TranITXT>Location Delivery minimum</TranITXT>
<Messages/>
<AutolosRule/>
<CreditReason/>
<RepCode>LOCMINDLV</RepCode>
</Line>
<StatementDetail>
<Code>CMUL9952</Code>
<Desc>Darrell Lea Chocolate Shop</Desc>
<Date>30 Apr 2006</Date>
<LineValue> 66.00 </LineValue>
</StatementDetail>
<StatementDetail>
<Code>CMUL15176</Code>
<Desc>Darrell Lea Chocolate Shop</Desc>
<Date>31 May 2006</Date>
<LineValue> 66.00 </LineValue>
</StatementDetail>
<StatementDetail>
<Code>CMUL18201</Code>
<Desc>Darrell Lea Chocolate Shop</Desc>
<Date>30 Jun 2006</Date>
<LineValue> 82.50 </LineValue>
</StatementDetail>
<StatementDetail>
<Code>RCPT12086</Code>
<Desc>Darrell Lea Chocolate Shop</Desc>
<Date>14 Jul 2006</Date>
</StatementDetail>
<StatementDetail>
<Code>CMUL25793</Code>
<Desc>Darrell Lea Chocolate Shop</Desc>
<Date>31 Jul 2006</Date>
<LineValue> 66.00 </LineValue>
</StatementDetail>
</Location>
</Client>
</Invoice>
</Branch>

Please help to put in VFP table. - thanks
 
You need to figure out how you want to use this data. It contains at least two related tables with a one-to-many relationship.

I think you need to hard code at least some of the import.

I wrote the blow 'quick and dirty" to see what would happen.

Make sure to browse all the way to the right as the 1st fields only occur once.

Code:
CLOSE DATABASES ALL

m.cXML = FILETOSTR("test.xml")
m.cSQL = ""
m.LineNum = 1
STORE CHR(13)+CHR(10) TO CRLF
CREATE DATABASE XML_DB
CREATE TABLE MyXML (CompanyName c(100))
APPEND BLANK 

FOR m.i = 1 TO GETWORDCOUNT(cXML, CRLF)
  m.cString = GETWORDNUM(cXML, m.i, CRLF)
  
  DO CASE 
    CASE "<Line>"$m.cString
      m.LineNum = m.LineNum + 1
      APPEND BLANK 
      
    CASE "/>" $ m.cString AND OCCURS(">", m.cString)=1 &&empty field
      m.cField = CHRTRAN(STRTRAN(ALLTRIM(m.cString),"/>",""),CHR(34)+"=< ","")
      IF VARTYPE(&cField) ="U"
        ALTER TABLE MyXML ADD COLUMN (m.cField) c(100)
      ENDIF 
  
    CASE "</" $ m.cString AND OCCURS(">", m.cString)=2 && field with data
      m.cField = CHRTRAN(STRTRAN(ALLTRIM(GETWORDNUM(m.cString,1,">")),"/>",""),CHR(34)+"=< ","")
      IF VARTYPE(&cField) ="U"
        ALTER TABLE MyXML ADD COLUMN (m.cField) c(100)
      ENDIF
      
      m.cData = GETWORDNUM(GETWORDNUM(m.cString,2,">"),1,"<")

      GO m.LineNum
      REPLACE (m.cField) WITH m.cData
          
    OTHERWISE 
      ?m.cString &&just to see what we're missing
  ENDCASE 
ENDFOR
 
finished it off..

Code:
CLOSE DATABASES ALL
CLEAR 
m.cXML = FILETOSTR("test.xml")
m.cSQL = ""
m.LineNum = 1
STORE CHR(13)+CHR(10) TO CRLF
CREATE DATABASE XML_DB
CREATE TABLE MyXML (CompanyName c(100), InvoiceNumber c(100), InvoiceType c(100), IsStatment c(10))
APPEND BLANK 

FOR m.i = 1 TO GETWORDCOUNT(cXML, CRLF)
  m.cString = GETWORDNUM(cXML, m.i, CRLF)
  
  DO CASE 
    CASE "<Line>"$m.cString
      m.LineNum = m.LineNum + 1
      APPEND BLANK 
      
    CASE "/>" $ m.cString AND OCCURS(">", m.cString)=1 &&empty field
      m.cField = CHRTRAN(STRTRAN(ALLTRIM(m.cString),"/>",""),CHR(34)+"=< ","")
      IF VARTYPE(&cField) ="U"
        ALTER TABLE MyXML ADD COLUMN (m.cField) c(100)
      ENDIF 
  
    CASE "</" $ m.cString AND OCCURS(">", m.cString)=2 && field with data
      m.cField = CHRTRAN(STRTRAN(ALLTRIM(GETWORDNUM(m.cString,1,">")),"/>",""),CHR(34)+"=< ","")
      IF VARTYPE(&cField) ="U"
        ALTER TABLE MyXML ADD COLUMN (m.cField) c(100)
      ENDIF
      
      m.cData = GETWORDNUM(GETWORDNUM(m.cString,2,">"),1,"<")

      GO m.LineNum
      REPLACE (m.cField) WITH m.cData
    
    CASE "<?xml version"$m.cString=.f. AND OCCURS(">",m.cString)=1 AND ;
      OCCURS("<",m.cString)=1 AND OCCURS("=",m.cString)=1 &&embeded data
      
      m.cField = CHRTRAN(STRTRAN(ALLTRIM(GETWORDNUM(m.cString,1,">")),"/>",""),CHR(34)+"=< ,","")
      IF VARTYPE(&cField) ="U"
        ALTER TABLE MyXML ADD COLUMN (m.cField) c(100)
      ENDIF
      
      m.cData = CHRTRAN(GETWORDNUM(GETWORDNUM(m.cString,2,"="),1,"<"),CHR(34)+">","")
      GO m.LineNum
      REPLACE (m.cField) WITH m.cData      
    
    CASE LEFT(ALLTRIM(m.cString),8)="<Invoice"
        m.cInvoiceNumber =GETWORDNUM(RIGHT(m.cString,1+LEN(m.cstring)-ATC("InvoiceNumber",m.cString)),2,CHR(34))
        m.cInvoiceType=GETWORDNUM(RIGHT(m.cString,1+LEN(m.cstring)-ATC("InvoiceType",m.cString)),2,CHR(34))
        m.cIsStatment=GETWORDNUM(RIGHT(m.cString,1+LEN(m.cstring)-ATC("IsStatment",m.cString)),2,CHR(34))
        
        REPLACE InvoiceNumber WITH m.cInvoiceNumber 
        REPLACE InvoiceType WITH m.cInvoiceType 
        REPLACE IsStatment WITH m.cIsStatment 
    
    OTHERWISE 
      ?m.cString &&just to see what we're missing
  ENDCASE 
ENDFOR

LOCATE
cInvoice ="xxxxxx"

SCAN
  IF !EMPTY(InvoiceNumber)
    m.cInvoice = InvoiceNumber
  ELSE  
    REPLACE InvoiceNumber WITH m.cInvoice 
  ENDIF
ENDSCAN

SELECT * FROM MyXML INTO TABLE Invoices WHERE !EMPTY(InvoiceType)
FOR m.i = FCOUNT() TO 1 STEP -1
  LOCATE FOR !EMPTY(EVALUATE(FIELD(m.i)))
  IF EOF()
    ALTER table DBF() drop COLUMN (FIELD(m.i))&&in future could append into set-up tables
  ENDIF 
ENDFOR 

SELECT * FROM MyXML INTO TABLE Transactions WHERE EMPTY(InvoiceType)
FOR m.i = FCOUNT() TO 1 STEP -1
  LOCATE FOR !EMPTY(EVALUATE(FIELD(m.i)))
  IF EOF()
    ALTER table DBF() drop COLUMN (FIELD(m.i))&&in future could append into set-up tables
  ENDIF 
ENDFOR

SELECT Invoices 
BROWSE NOWAIT 

SELECT Transactions 
BROWSE NOWAIT
 
Thanks baltman. It works. Once again thanks for teaching me. It helped lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top