How Do I Handle Errors Encountered During XML Access? (Magic xpa 4.x)
Some of the XML functions give return codes which can be used to determine that an error occurred. For instance, XMLSetEncoding() returns a 0 if it worked properly, a negative value otherwise.
Note: Since the return code can be negative, be sure your variable allows negative values (that is, that the picture contains an āNā, ā5Nā for example).
All the error codes are negative integers. So, you can create a handler that will be triggered whenever your return code becomes negative, as shown here.
If you use a return code in the Main Program, you can capture the error globally for all your XML functions.
The same return code values are used for all the XML functions, so you can also create user-friendly error messages. The error codes are listed in the Magic xpa Help file for the function.
The Online and Rich Client Samples projects (program XM12 and RXM12)