General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion How to write a macro to batch validate multiple documents

  • amy.kidd

    How to write a macro to batch validate multiple documents

    Participants 4
    Replies 5
    Last Activity 9 years ago

    Hello,

    I'm using XMetaL Author Enterprise 7.0.

    I know I can validate one document at a time by pressing F9 with my document open.

    I'd love to be able to validate all the documetns in a directory using the Cross-File Operation. Alternately, I'd like to use a new macro that runs F9 validate function on all my documents at once and produce a log file. I want to do this without publishing the document. Xmetal is almost there with the validate links Cross-File Operation, but I'd like to just validate the XML.

    Can you point me in the right direction?

    Many Thanks!

    Reply

    Derek Read

    Reply to: How to write a macro to batch validate multiple documents

    This functionality is still experimental for implementing your own scripts but I'm attaching a demo that may give you what you are looking for.

    To try it out unzip the file I'm attaching and place ValidateDocuments.js into the subfolder in your XMetaL Author Essential or XMetaL Author Enterprise installation here:
    C:Program FilesXMetaL 7.0AuthorXMDKMFOServiceservicecustomScripts
    – or –
    C:Program FilesXMetaL 8.0AuthorXMDKMFOServiceservicecustomScripts

    You will need to restart XMetaL Author to have it load. A new Cross-File Operation will then be available named “Validate Documents”.

    I've tested this with XMetaL Author Enterprise 8.0.1.041. Please let me know if there are issues with your version.

    We've taken a guess at what you want to display in the Results panel. Please provide feedback.

    Reply

    amy.kidd

    Reply to: How to write a macro to batch validate multiple documents

    Hi Derek,

    Thank you so very much for sharing this script!

    On Xmetal 7.0, it appears to only work for files with the .xml extension. It did let me know one file in my test directory did not validate (that was correct).

    However, I mostly use files with the .dita extension. Can the script be fixed easily with a simple change into recognize .dita files as the same as .xml files?

    Also, I did try it in a Xmetal 8 trial version and it seems to process all the files with dita or xml extension, but it says they are all correct but I have one file I know has an error in it.

    That might simply be a result of my not setting something up correctly with my custom DTDs.

    Nevertheless, I only need it for Xmetal 7 at this point.

    Thanks Again!

    Reply

    amy.kidd

    Reply to: How to write a macro to batch validate multiple documents

    Derek,

    After running other cross file operations and using the spell-check in files feature in XMetaL Author 7.0 Enterprise Edition and XMetaL Author 8.0 (trial version), it appears that in my version of Xmetal 7.0, none of the cross file operations recognize the files with the .dita file extension. XMetal 8.0, however, does recognize the .dita files.

    Is there anything I can change in the Xmetal Author 7.0 settings currently to make this work for me now?

    Reply

    Derek Read

    Reply to: How to write a macro to batch validate multiple documents

    In 7.0 do this:

    1. Alt+S.
    2. Select “Multiple File Operation Services”.
    3. Click “Extended Info”.
    4. Check to see that “dita” is listed (it should be if this is XMetaL Author Enterprise).
    5. Click “Done”.

    The dialog populates itself with “dita” as a filetype to search, but the default configuration file used by the cross files operations did not include it. When you click “Done” the dialog writes out a new copy of the config file used by the CFO feature. You can add other file types here as well.

    Reply

    amy.kidd

    Reply to: How to write a macro to batch validate multiple documents

    IMPORTANT! When you view/update the list of file extensions in the Multiple-File Operation Preferences, ensure the list ends with a file extension and not a semicolon.

    For example, my default settings were as follows:

    xml;sgml;sgm;dita;ditamap;

    As a result of this setting, the multiple-file operations were not recognizing my files with a .dita extension.

    I changed the settings to this:
    xml;dita;ditamap

    When I removed the ending semicolon, and restarted Xmetal (just for good measure), it works like a charm.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support