Hi,
I need to get information from an xml file. So I create 'Microsoft XML, v4.0' automations variables with subtype:DOMDocument, IXMLDOMNodeList, IXMLDOMNode and IXMLDOMElement.
I create this variables, using CREATE() function.
When I run my codeunit, an error is occurs on the creation of all automations variables, except DOMDocument...
--> the error message is like: "cannot create OLE instance control or automation server identify with GUID={...} Check the OLE control or the automation server is correctly intalled and registered"
I got the same error with all others versions of 'Microsoft XML' (2.0, 2.6,
and 3).
Does someone met this problem yet?
Why DOMDocument subtype works, and not the others? :roll:
Thank's
Comments
i use the following code to import xml-files:
variables:
Name, DataType, Subtype Length
XMLFile, File
XMLInStr, InStream
XMLDOMDocument, Automation, 'Microsoft XML, v3.0'.DOMDocument
CurrNode, Automation, 'Microsoft XML, v3.0'.IXMLDOMNode
this should work.
greetings, oliver
your help is totally right, but you can even use the XMLDoc.load method for directly loading a file...
XMLDOMDocument.load(XMLFilename);
CurrNode := XMLDOMDocument.documentElement;
MESSAGE(CurrNode.nodeName);
With this you don`t need to use the stream...
This is very helpful when loading a file with unknown encoding (the most terrific theme while using navision )...
On the other hand you should ever use the return parameter of the load call. Means:
if not XMLDOMDocument.load(XMLFilename) then
ERROR(XMLDOMDocument.parseError.reason)
else ...
Stefan