26. Oktober 2009 17:25
- <PURCHASEORDER>
- <PURCHASEORDERHEADER>
<DOCUMENTNO>110905994</DOCUMENTNO>
</PURCHASEORDERHEADER>
- <PURCHASEORDERLINE>
<LINENO>10000</LINENO>
<LINENO>20000</LINENO>
</PURCHASEORDERLINE>
</PURCHASEORDER>
Variablen:
Name DataType Subtype
XMLDOMDocument Automation 'Microsoft XML, v3.0'.DOMDocument
XMLDOMManagement Codeunit XML DOM Management
CurrNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
XMLNodeFound Automation 'Microsoft XML, v3.0'.IXMLDOMNode
IF ISCLEAR(XMLDOMDocument) THEN
CREATE(XMLDOMDocument);
XMLDOMDocument.load('c:\Test\Export\Test.xml' );
CurrNode := XMLDOMDocument.documentElement;
WITH XMLDOMManagement DO BEGIN
IF FindNode(CurrNode, 'PURCHASEORDERHEADER', XMLNodeFound) THEN BEGIN
CurrNode := XMLNodeFound;
IF NOT FindNode(CurrNode,'DOCUMENTNO',XMLNodeFound) THEN
EXIT
ELSE
IF STRLEN(XMLNodeFound.text) > 0 THEN BEGIN
Message('%1',XMLNodeFound.text)
END;
CurrNode := CurrNode.parentNode;
END;
IF FindNode(CurrNode, 'PURCHASEORDERLINE', XMLNodeFound) THEN BEGIN
//-------------Repeat ?????????
CurrNode := XMLNodeFound;
IF NOT FindNode(CurrNode,'LINENO',XMLNodeFound) THEN
EXIT
ELSE
IF STRLEN(XMLNodeFound.text) > 0 THEN BEGIN
MESSAGE('%1',XMLNodeFound.text);
END;
CurrNode := CurrNode.parentNode;
//-------------Until ????????
END;
END;
CLEAR(XMLDOMDocument);
26. Oktober 2009 17:37
xmlNodeList := DocNode.SelectNodelist('PURCHASEORDERLINE');
ItemCount := xmlNodeList.Length;
i:=0;
while (i < ItemCount) do begin
.......
end;
26. Oktober 2009 17:48
26. Oktober 2009 18:25
Name DataType Subtype Length
XMLDoc Automation 'Microsoft XML, v4.0'.DOMDocument
XMLMainNodeList Automation 'Microsoft XML, v4.0'.IXMLDOMNodeList
27. Oktober 2009 10:08
7. April 2010 11:29
LocXMLDoc@1000000000 : Automation 'Microsoft XML, v4.0'.DOMDocument";
LocXMLNode@1000000004 : Automation 'Microsoft XML, v4.0'.IXMLDOMNode";
LocXMLNodeList@1000000001 : Automation 'Microsoft XML, v4.0'.IXMLDOMNodeList";
ItemCount@1000000003 : Integer;
i@1000000002 : Integer;
IF ISCLEAR(LocXMLDoc) THEN CREATE(LocXMLDoc);
IF LocXMLDoc.load('D:\test.xml') THEN BEGIN
LocXMLNode := LocXMLDoc.documentElement();
MESSAGE('Root is: %1', LocXMLNode.nodeName);
LocXMLNodeList := LocXMLNode.selectNodes('//PURCHASEORDERLINE/LINENO');
ItemCount := LocXMLNodeList.length;
i:=0;
WHILE (i < ItemCount) DO BEGIN
MESSAGE( '%1', LocXMLNodeList.item(i).text );
i += 1;
END;
END ELSE BEGIN
MESSAGE('Die XML-Datei konnte nicht geladen werden!');
END;
<?xml version="1.0" ?>
<PURCHASEORDER>
<PURCHASEORDERHEADER>
<DOCUMENTNO>110905994</DOCUMENTNO>
</PURCHASEORDERHEADER>
<PURCHASEORDERLINE>
<LINENO>10000</LINENO>
<LINENO>20000</LINENO>
<LINENO>30000</LINENO>
<LINENO>40000</LINENO>
</PURCHASEORDERLINE>
<PURCHASEORDERLINE>
<LINENO>10000</LINENO>
<LINENO>20000</LINENO>
<LINENO>30000</LINENO>
</PURCHASEORDERLINE>
</PURCHASEORDER>