IXMLDOMParseError

DonSchilloDonSchillo Member Posts: 8
Hello everyone,
I'm new in this forum and I hope I can explain my problem properly. I have created a XMLPort to import XMLdata in a table. THe XMLport is called by a function in the table. In some cases the MS XML Parser reports an error in several files when i just start the XMLport by XMLPORT.IMPORT(50999,l_DMSBelegInStream).
In order to not interupt the loop which imports and xcopies the files, I used an IF statement [IF XMLPORT.IMPORT(50999,l_DMSBelegInStream)THEN BEGIN]. That works pretty fine. The problem is that I cannot see anymore which error occured for the files not imported and left in the folder.
Therfore I tried to use the IXMLDOMParseError which I'm not familiar with.
-I declared it as an Automation variable of type 'Microsoft XML, v4.0'.IXMLDOMParseError'
-I created an instance of it before my loop with a CREATE statement
-I added the following code within the loop
IF XMLParser.errorCode <> 0 THEN BEGIN
MESSAGE('Error validating XML file: \'
+ XMLParser.reason
+ '\Line: ' + FORMAT(XMLParser.line) +' ' );
END;

The compiler reports no error but when I start the import, I get an error saying:
"This message is for C/AL programmers:
Could not greate an instance of the ole control or Automation server identified by GUID={F5078F18-C551-11D3-89B9-0000F81FE221} 4.0:{3EFAA426-272F-11D2-836F-0000F87A7782}: 'Microsoft XML,v4.0' IXMLDOMParseError. Check that the OLE control or Automation server is correctly installed and registered."


Can anyone tell me which ocx or dll contains this Automation Server an who I have to install an register ist. I tried it with the msxml4.dll but it didn't work.

Thanks for your replys.

Comments

  • ta5ta5 Member Posts: 1,164
    Try this:
    You first open the xmlDoc with the load method, then initalize the xmlParseError assigning it to the xmlDoc.parseError-Property.
    CREATE(xmlDoc);
    xmlDoc.load(FilePath + FileName);
    xmlParseError := xmlDoc.parseError;
    
    IF xmlParseError.errorCode <> 0 THEN
    ..
    

    Hope this helps
    Thomas
  • DonSchilloDonSchillo Member Posts: 8
    Hello ta5,
    thank you for your reply. Unfortunatelly it didn't work. The error message still occurs. It's nearly the same. Only the GUID has changed. It seems to me that all these methods must be reristered somewhere by an ocx or dll. But I don't know which ocx or dll and where to register it.
  • ta5ta5 Member Posts: 1,164
    1) Do you have a partner license (are you a solution center)?
    2) When you create a new variable of automation type, can you select this 'Microsoft XML, v4.0'.IXMLDOMDocument40?
    If not, then the DLL's are not registered.
  • DonSchilloDonSchillo Member Posts: 8
    1) Yes I'm from a Solution Center and we have a Partner license

    2) Yes I can select this 'Microsoft XML, v4.0'.IXMLDOMDocument40 when I create a new variable
  • jlandeenjlandeen Member Posts: 524
    One thing to check when working with XML files and checking properties is the Async flag. It is possible that the file may not be completely loaded when you are trying to check the PageError property.

    You may want to set the ASYNC property of the XML document object to false before you try and load any XML data and then check the error.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • DonSchilloDonSchillo Member Posts: 8
    Now it works, The code provided by ta5 was correct, I simply forgot a CREATE statement. The hint with the Async Flag is very interesting. I'll check this too.

    Thanks to everyone for the help.
Sign In or Register to comment.