Microsoft XML' automation

Cryo
Member Posts: 13
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
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
0
Comments
-
you don't need to do a create on every automation
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// Opens and imports the XML XMLFile.OPEN(FileName); XMLFile.CREATEINSTREAM(XMLInStr); // Creates the XMLDOMDocument CREATE(XMLDOMDocument); // Loads the XML into the DOMDocument XMLDOMDocument.load(XMLInStr); // Closes the XML-File XMLFile.CLOSE(); // Get the current Node CurrNode := XMLDOMDocument.documentElement; // Message with the current Nodename MESSAGE(CurrNode.nodeName);
this should work.
greetings, oliver0 -
hi 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 ...
Stefan0 -
thanks!0
-
Thank's a lot0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions