cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Check Completness in batch mode

SindyYoung
2-Guest

Check Completness in batch mode

Hi Everyone,
We are working in data modules using the S1000D specification, and using Arbortext Editor as our authoring tool. My question "Is there a way to do a check completeness on a group of data modules at once, or must we open each file individually to do a completeness check?

Sindy Young
AWACS Tools and Technology Team,
(253) 657-6964
Kent, WA 98032
4 REPLIES 4

Hi, Sindy...

What kind of result would you be looking for, particularly in the case
of modules that do not pass the check? Maybe just a plain text
listing of the files with a pass/fail for each, or maybe just a list
of those that didn't pass, so the user knows which ones to open up in
Editor for closer inspection?

If your requirements aren't too much more complicated than that, it
should be relatively easy to construct a snippet of ACL to run on each
file to invoke the completeness check and report the result in an
appropriate form, which could then be run from the command line using
the -b and -c (or -C1 or -C2, depending on your environment) options.

-Brandon 🙂


Brandon,

We are interested in getting a list of data modules that fail the completeness check.
We have data modules in this structure:
Data\xx\*.xml
Data\yy\*.xml
Data\zz\*.xml

It will be great if the ACL can run the completeness check for all the xml files within the sub directories in the "Data" (as an example) folder.

Any suggestions?
Sindy

Are they spearated by doctype? procedures in one folder, ipb in another?

If so you can use Kernow to just validate with the schema.

..dan

> Brandon,
>
> We are interested in getting a list of data modules that fail the
> completeness check.
> We have data modules in this structure:
> Data\xx\*.xml
> Data\yy\*.xml
> Data\zz\*.xml
>
> It will be great if the ACL can run the completeness check for all the xml
> files within the sub directories in the "Data" (as an example) folder.
>
> Any suggestions?
> Sindy
>

Something like the following might do what you need. You could put it
in a file that you source before invoking the function, or just place
the file in the "init" folder in your custom directory, so it's always
available.

The function takes a file name pattern (e.g., 'Data\??' to match items
with two-character names). Directories matching the pattern are then
searched for ".xml" files, each of which is checked and a list of
those that couldn't be opened or failed the completeness check is
returned.

I've left the task of writing the resulting list to a file or to
standard output as an exercise, since I don't know how you intend to
invoke Editor to run this, or if you'll have something processing the
result. Check back if you get stuck on that part.

Caveat: I did test this, but then I reformatted, added comments and
tweaked a bit, so no guarantees. 😉

-Brandon 🙂


function check_directories(pat){ local dirs[], files[], doc, i, j =
0, s = ";
# Make a list of items matching "pat" that are directories
glob(pat, files); for (i in files) { if
(file_directory(files[i])) { dirs[j++] = files[i]; } }
# Search each directory for XML files and check each one for (i
in dirs) { glob(dirs[i] . '\*.xml', files); for (j in
files) { # 1024 = fail quietly if document type
can't be loaded # 512 = do not load a stylesheet
# 32 = suppress parser errors and warnings # 1 = open
read-only doc = doc_open(files[j], 1024+512+32+1);
if (doc < 0 || doc_incomplete(doc, 3)) { #
Document couldn't be opened or failed completeness check
s = s . files[j] . "\n"; } doc_close(doc);
} }
# Return list of files needing attention return s;}

Announcements

Top Tags