Customize Error when failing to load an XML document

PhoenixCNCPhoenixCNC Member Posts: 12
edited 2017-08-02 in NAV Three Tier
When I attempt to load an XML document such as
xmlDoc.Load('\\Server\Shared\NavData_Public\Testing\' + cuCPUtils.UserBatch() + 'BOT2.xml') sometimes it may error because the document isn't always XML friendly. I see an error like
Microsoft Dynamics NAV

This message is for C/AL programmers: A call to System.Xml.XmlDocument.Load failed with this message: Unexpected end tag. Line 2, position 3.
OK

I thought you'd be able to do something like

IF xmlDoc.Load('\\Server\Shared\NavData_Public\Testing\' + cuCPUtils.UserBatch() + 'BOT2.xml') TRUE THEN BEGIN but this is void. Is there any other way to display my own message when this occurs?

Best Answer

Answers

  • guidorobbenguidorobben Member Posts: 157
    in what version of NAV?
  • PhoenixCNCPhoenixCNC Member Posts: 12
    in what version of NAV?

    2013.
  • JuhlJuhl Member Posts: 724
    Or use a separate codeunit for the passe and use the return value.

    If codeunit.run then begin
    Follow me on my blog juhl.blog
Sign In or Register to comment.