Hi All
The source xml file contains the following contents.
I need to import this contents into NAV Buffer table by using some coding or through XMLPort.
The buffer table need to be filled with 3 records.
I have tried with this codes
LoyaltyFile.OPEN('c:\Loyal.xml');
LoyaltyFile.CREATEINSTREAM(TextStream);
XMLPORT.IMPORT(50000,TextStream);
LoyaltyFile.CLOSE;
Can anyone pls suggest the best way to import this contents into my table?
The xml content is :
- <Soap:Envelope xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/">
- <Soap:Body>
- <ReadMultiple_Result xmlns="urn:microsoft-dynamics-schemas/page/loyalty">
- <ReadMultiple_Result>- <Loyalty>
<Key>1201880</Key>
<Receipt_No>7</Receipt_No>
<Points>78</Points>
<Date_Of_Issue>2011-05-24</Date_Of_Issue>
<Card>300</Card>
<Entry_Type>Sale</Entry_Type>
<Transaction_No>0</Transaction_No>
<Expiration_Date>0001-01-01</Expiration_Date>
</Loyalty>- <Loyalty>
<Key>1201890</Key>
<Receipt_No>8</Receipt_No>
<Points>59</Points>
<Date_Of_Issue>2005-01-01</Date_Of_Issue>
<Card>300</Card>
<Entry_Type>Sale</Entry_Type>
<Transaction_No>0</Transaction_No>
<Expiration_Date>0001-01-01</Expiration_Date>
</Loyalty>- <Loyalty>
<Key>1201900</Key>
<Receipt_No>9</Receipt_No>
<Points>35</Points>
<Date_Of_Issue>2011-05-24</Date_Of_Issue>
<Card>300</Card>
<Entry_Type>Sale</Entry_Type>
<Transaction_No>0</Transaction_No>
<Expiration_Date>0001-01-01</Expiration_Date>
</Loyalty></ReadMultiple_Result>
</ReadMultiple_Result>
</Soap:Body>
</Soap:Envelope>
Comments
You need some xPath programming within the DOM. xmlPort is another possibility, but personally I dont like xmlPorts. Here is an example on xPath Programming
viewtopic.php?f=23&t=41749
Basically you have a loop looping on the relevant nodes, and within that loop you get the fields and store them in the table.
Hope this helps
Thomas
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.