XML – SetAttribute can cause Navision to crash

There is an error in the XML DOM automation which can cause Navision to crash. This looks like a kind of memory leak and will therefore often occur in automated/scheduled jobs.

The error occurs when using setAttribute directly on the XML Dom Element. To prevent a crash, use a function to set the Attribute.

The function could look like this:

IF ISCLEAR(XMLDoc) THEN
…..CREATE(XMLDoc);

XMLAttribute := XMLDoc.createAttribute(AttributeName);
XMLAttribute.value(Value);
XMLElement.setAttributeNode(XMLAttribute);
CLEAR(XMLAttribute);

where the local variables are:

  • XMLDoc is Microsoft XML, v4.0′.DOMDocument
  • XMLAttribute is Microsoft XML, v4.0′.IXMLDOMAttribute

and the function parameters are:

  • Value is Text 1024
  • AttributeName is Text 1024
  • XMLElement is var and a Automation “‘Microsoft XML, v4.0’.IXMLDOMElement”

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.