Importing xml document using XMLDOM automation

Hi All,

im trying to import a XML document containing invoice lines via XMLDOM Automation.

Code:

//Import Invoice Lines
IF XMLDOMMgmt.FindNodes(CurrNode, '/rsm:CrossIndustryDocument/rsm:SpecifiedSupplyChainTradeTransaction/' +
'ram:IncludedSupplyChainTradeLineItem', CurrNodeList) THEN BEGIN
NoOfCurr := CurrNodeList.length;

FOR i := 1 TO NoOfCurr DO BEGIN
CurrNode := CurrNodeList.item(i - 1);

IF XMLDOMMgmt.FindNode(CurrNode, '/rsm:CrossIndustryDocument/rsm:SpecifiedSupplyChainTradeTransaction/' +
'ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineID', CurrNode2) THEN BEGIN
InsertNewLog(PurchaseInvoiceXMLImport, NewEntryNo);
EVALUATE(PurchaseInvoiceXMLImport."Line No.", CurrNode2.text);
PurchaseInvoiceXMLImport.INSERT;
//insert details here
PurchaseInvoiceXMLImport.MODIFY;
END;
CurrNode := CurrNodeList.nextNode();
END;
END;

According to several Messages all 26 Nodes '/rsm:CrossIndustryDocument/rsm:SpecifiedSupplyChainTradeTransaction/' +
'ram:IncludedSupplyChainTradeLineItem' in the document are found.

The problem occurs with the following lineof code where I try to search within a special node accordingto the loop:

IF XMLDOMMgmt.FindNode(CurrNode, '/rsm:CrossIndustryDocument/rsm:SpecifiedSupplyChainTradeTransaction/' +
'ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ram:LineID', CurrNode2) THEN BEGIN
InsertNewLog(PurchaseInvoiceXMLImport, NewEntryNo);

Eventhough CurrNode ist up to date the function FindNode" always finds the very first occurence of "ram:LineID".

Where is my mistake?


Please find a brief Screenshot of the document structure attached.

I hope somone will help :-(
Sign In or Register to comment.