Hello everyone
The xml is an example of an xml data that can be loaded to Excel. When it is loaded In Excel you will get 2 worksheet one called “ARTIKEL_OCH_PRODUKT” and the other called “PRODUKTTEXTER.”
My data is split between the 2 Worksheets.
What I am trying to do is read sequentially each record in Worksheet=ARTIKEL_OCH_PRODUKT then perform a lookup using the PRODUKTID=731110 for the 2 descriptions which is held in the other Worksheet=PRODUKTTEXTER
I can’t get hold of the Siblings text after the search : Workbook/Worksheet[@ss:Name=“PRODUKTTEXTER”]/Table/Row/Cell/Data[text() = “731110”]
ARTIKELNUMMER
BENÄMNING
INFO
PRODUKTID
PRODUKTNAMN
BILDNAMN
PRODUKTKOPPLING_DUBLETT
>
1000-00-0017
731110
…
…
PRODUKTID
PRODUKTNAMN
PRODUKTBESKRIVNING
731110
and this****
CREATE(XmlDocL);
XmlDocL.async(FALSE);
sPathFileNameG := ‘C:\incadea\SI-Data\02 Web-Shop\Job6_20140314\XML_DUELLS\ATV.xml’;
XmlDocL.load(sPathFileNameG);
XmlNodeListL := XmlDocL.getElementsByTagName(‘Workbook/Worksheet’);
FOR iNodeListL := 0 TO XmlNodeListL.length - 1 DO BEGIN
XmlDomElimateL := XmlNodeListL.item(iNodeListL);
xmldomAttribL := XmlDomElimateL.getAttributeNode(‘ss:Name’);
IF NOT(ISCLEAR(xmldomAttribL)) THEN
cWorksheetNameL := xmldomAttribL.value
ELSE
cWorksheetNameL := ‘’;
CASE cWorksheetNameL OF
‘ARTIKEL_OCH_PRODUKT’: // ARTIKEL_OCH_PRODUKT
BEGIN
CurrNodeL := XmlNodeListL.item(iNodeListL);
XmlNodeList2L := CurrNodeL.selectNodes(‘Table/Row’);
// Skip First Headings which is first record
FOR iNodeList2L := 1 TO XmlNodeList2L.length - 1 DO BEGIN
CurrNodeL := XmlNodeList2L.item(iNodeList2L);
XmlNodeList3L := CurrNodeL.selectNodes(‘Cell’);
rItemL.“No.” := FindNodeItem(XmlNodeList3L, 0); // Item No
cProduktidL := FindNodeItem(XmlNodeList3L, 3); // Produktid
// Workbook/Worksheet[@ss:Name=“PRODUKTTEXTER”]/Table/Row/Cell/Data[text() = “731110”]
CurrNode2L := XmlDocL.selectSingleNode(STRSUBSTNO(
‘Workbook/Worksheet[@ss:Name=“PRODUKTTEXTER”]/Table/Row/Cell/Data[text() = “%1”]’
,cProduktidL));
// This Works
IF NOT ISCLEAR(CurrNode2L) THEN
IF NOT CONFIRM(STRSUBSTNO(’%1 : PRODUKTID %2’, iNodeList2L, CurrNode2L.text))THEN
ERROR(’’);
// I Can’t get the next nextSibling because it does not exits
CurrNode3L := CurrNode2L.nextSibling;
IF NOT ISCLEAR(CurrNode3L) THEN
IF NOT CONFIRM(STRSUBSTNO(’%1 : PRODUKTNAMN %2’, iNodeList2L, CurrNode3L.text))THEN
ERROR(’’);
END;
END;
‘PRODUKTTEXTER’: // PRODUKTTEXTER
BEGIN
CurrNodeL := XmlNodeListL.item(iNodeListL);
XmlNodeList2L := CurrNodeL.selectNodes(‘Table/Row’);
MESSAGE(FORMAT(XmlNodeList2L.length));
END;
END;
END;