Jump to content
Developer Wiki and Function Reference Links ×

Looking for list of XML error codes


MullinRJ

Recommended Posts

Does anyone know were a list of XML errors may be published? 

 

The following script was copied from the Developer Wiki from the VS:WriteXMLMemory() page. I modified it to trap any XML error generated along the way. On my computer running VW 2019 it generates an error for WriteXMLMemory(). The error is -21. Even with the -21 error, the function writes a value to variable "mem" which I display at the end of the program regardless of any errors.

PROCEDURE test;
VAR	xml : LONGINT;
	err : INTEGER;
	mem : DYNARRAY OF CHAR;
	value : STRING;
BEGIN
	mem := '';
	xml := InitXML;

	err := CreateNewXMLDocument(xml, 'root');
	if (err = 0) then begin
		err := SetElementValue(xml, '/root/value', '34');
		if (err = 0) then begin
			err := WriteXMLMemory(xml, mem);
			if (err = 0) then AlrtDialog(mem)
			else AlrtDialog(concat('Error= ', err, ' in WriteXMLMemory()'));
		end
		else AlrtDialog(concat('Error= ', err, ' in SetElementValue()'));
	end
	else AlrtDialog(concat('Error= ', err, ' in CreateNewXMLDocument()'));

	err := ReleaseXML(xml);
	if (err <> 0) then AlrtDialog(concat('Error= ', err, ' in ReleaseXML()'));
	
	{ Show value of  variable "mem" w/ or w/o XML errors }
	AlrtDialog(mem);

END;
RUN(test);

 

TIA,

Raymond

 

Link to comment

Nicolas, thank you. That is exactly what I was looking for. Usually I look at the HTML and the Dev Wiki pages for calls that are confusing or under documented. I missed this one. I guess it wasn't confusing enough.

 

Now to find out why WriteXMLMemory() seems to work, yet kicks a -21 error (Invalid XML handle). Oh the joys of programming.

 

Again, thank you.

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...