Home Forums General XMetaL Discussion Turn off: Automatic Validation befor Saving a Document Reply To: Turn off: Automatic Validation befor Saving a Document

Derek Read

Reply to: Turn off: Automatic Validation befor Saving a Document

Turning Rules Checking off (either using the rules_checking_always_off INI setting or the API) affects editing only. Validation is still performed as part of a save action in this case.

You may try this INI setting:
validate_before_export = boolean
The default value is yes.
Set the value to no to suppress validation during saves.

If this is not acceptable (this will affect all documents until you set the value to no and restart) you could override the File.Save and File.SaveAs events. Such a script would need to specifically not call the ActiveDocument.Save() nor ActiveDocument.SaveAs() methods but instead use something else to write the string obtained from the ActiveDocument.Xml property. You might use one of the standard Windows COM controls that provide write to disk functionality to do this, including MSXML, FileSystemObject, or ADODB.Stream, or another control if you know all your users will have it installed.

The alternative would be to provide another completely separate macro (ie: call it “Save without Validation”) that would again use ActiveDocument.Xml and write that string out using one of the COM controls mentioned above or a similar method to write to disk. Then your users would have the option of using the standard Save function with validation and this other one that does not perform validation.

I'm not sure if this second one is really worth the effort or not, because you can still save an invalid document by selecting the Save button when prompted with the following dialog and users advanced enough to know they want to create invalid documents on purpose might be trained to understand what this means:

XMetaL Author Enterprise

The document is not valid.
If you save the document will contain invalid markup.

[Save] [Cancel]