Jump to content
Developer Wiki and Function Reference Links Read more... ×
MullinRJ

Looking for list of XML error codes

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

 

Share this post


Link to post

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

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×