<?xml version="1.0" encoding="UTF-8" ?> - <Envelope> <subject>Reference rates</subject> - <Sender> <name>European Central Bank</name> </Sender> - <Cube> - <Cube time="2012-05-14"> <Cube currency="USD" rate="1.2863" /> <Cube currency="JPY" rate="102.64" /> <Cube currency="BGN" rate="1.9558" /> </Cube> </Cube> </Envelope>
IF ISCLEAR(XMLHTTP) THEN IF NOT CREATE(XMLHTTP) THEN ERROR(Text000); GLSetup.GET; GLSetup.TESTFIELD("URL Latest Currency Rates"); // URL := 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml'; // URL := 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'; URL := GLSetup."URL Latest Currency Rates"; XMLHTTP.open('GET',URL,FALSE); XMLHTTP.send(); IF (XMLHTTP.status = 200) THEN BEGIN IF ISCLEAR(XMLDoc) THEN IF NOT CREATE(XMLDoc) THEN ERROR(Text000); XMLDoc.async := FALSE; XMLDoc.load(XMLHTTP.responseBody); IF RemoveNamespace(XMLDoc,XMLDoc,Filename) THEN BEGIN WITH TmpCurrExchRate DO BEGIN XMLNode := XMLDoc.documentElement; XMLNodeList := XMLNode.selectNodes('Envelope'); XMLNodeList.reset; REPEAT TmpCurrExchRate.INIT; XMLNode := XMLNodeList.nextNode; IF FindNode(XMLNode,'Sender',XMLReturnedNode) THEN IF STRLEN(XMLReturnedNode.text) > 0 THEN MyText := XMLReturnedNode.text IF FindNode(XMLNode,'Cube',XMLReturnedNode) THEN IF STRLEN(XMLReturnedNode.text) > 0 THEN MyText := XMLReturnedNode.text; IF FindNode(XMLNode,'Cube currency',XMLReturnedNode) THEN IF STRLEN(XMLReturnedNode.text) > 0 THEN MyText := XMLReturnedNode.text; IF TmpCurrExchRate.INSERT(TRUE) THEN; UNTIL COUNT = (XMLNodeList.length); END;
IF ISCLEAR(XMLRootNode) THEN EXIT(FALSE); IF NOT NormalCaseMode THEN NodePath := NodePath; FoundXMLNode := XMLRootNode.selectSingleNode(NodePath); IF ISCLEAR(FoundXMLNode) THEN EXIT(FALSE) ELSE EXIT(TRUE);
XMLNode Automation 'Microsoft XML, v6.0'.IXMLDOMNode XMLReturnedNode Automation 'Microsoft XML, v6.0'.IXMLDOMNode XMLNodeList Automation 'Microsoft XML, v6.0'.IXMLDOMNodeList
Answers
IF FindNode(XMLNode,'Cube',XMLReturnedNode) THEN
IF FindNode(XMLReturnedNode,'@currency',XMLReturnedAtt) THEN
Please give it a shot...
Peter
It didn't help, BUT instead you brought me unto something else, and in my search I found this msdn blog entry http://blogs.msdn.com/b/nav_developer/archive/2008/03/31/sample-of-how-to-read-a-simple-xml-document-using-msxml-dom-in-nav.aspx
that can help me process the XML DOM Document. I'm not finished yet, but now I can get to the values of the attributes, and from there put it into a table :-) Damn, that has taken me a loooooong time ](*,)
So, thanks anyway!
zeon
Peter