Home › Forums › General XMetaL Discussion › How to speed up Open, Edit, and Save › Reply To: How to speed up Open, Edit, and Save
Reply to: How to speed up Open, Edit, and Save
October 16, 2012 at 6:52 pmIs your “edit” step is automated? i.e.: No human author involved, but using script and perhaps working on many files? I'm getting that feeling. If so, you could hide everything except the root element at open (using display:none for * or even selected elements below root) and still be able to manipulate the XML using all of the XMetaL APIs (using Range or DOM, Selection won't work because it can only do what an author can do).
If not, then optimizing anything will depend on the needs of your authors so giving a specific answer is going to be difficult I think.
Turning off Rules Checking may speed some things up, but again, you will most likely want to leave that on when authors are editing files.
Closing the Attribute Inspector can speed things up in some cases as well.
Regarding #3:
There is no INI setting for collapsing tags when a document is opened, but you could write a script to do it. I'm not sure this will help much though. In order for an author to do anything with the document they'll need to expand the elements and then a full render will occur (which defeats the purpose of collapsing them in the first place). So, I think this would only be useful if you are manipulating the document using script, and CSS display:none is probably an easier and possibly better option anyway.
You could try something similar to this though:
var docNode = ActiveDocument.documentElement;
var rootElem = ActiveDocument.Range;
rootElem.SelectNodeContents(docNode);
rootElem.CollapsedContainerTags = true;
]]>
If you are manipulating the content via scripting (no humans involved at all) then we might have an option for you in the future. The new “Find in Files” and “Spellcheck in Files” in XMetaL Author 7.0 use an “invisible” copy of XMetaL Author (an ActiveX version) to load files without rendering them. There is a third option that we have provided some examples for (accessible via Tools > Run Cross-File Operation) but how to build these “operations” has not yet been documented and the feature isn't really finalized yet. It might be something to consider for the future though. Essentially it allows you to load a document, or multiple documents, into an invisible copy of XMetaL without rendering them (so saving all that overhead) while still providing access to Range, DOM and most Document object APIs to work on the file(s).