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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Context Checking All Files in a Map at once?

Liam
4-Participant

Context Checking All Files in a Map at once?

Perhaps I'm missing something obvious here, but it seems like there should be a way for Arbortext Editor to validate all of the XML files that are referenced from the same map or bookmap. A Completeness Check happily reports everything is OK, even when referenced files have gross Context Errors.


One can open a file with context errors from a <topicref> within a map, and the Editor simply either shows a red element where the problem is, or simply adds elements to "fix" the problem. It does not turn context rules off and report an error.


Is there a way, through AE, the AE command line, or through custom ACL to check a related file set without having to open every file? Does this require the use of an external XML parser?


Thanks!

11 REPLIES 11

Hi Bill--

A quick way around this is to open your map file and from the menus choose Edit->Edit Resolved Document->For Editing. This will create a "wrapper" document that will import all your topics by reference, and will report context errors found in any of the topic documents.

--Clay
Liam
4-Participant
(To:Liam)

Hi Clay,


I tried that before posting, as I too thought it might be the solution. The result is that the Editor happily adds opening/closing elements without reporting a problem. It also simply shows invalid tags in red, instead of reporting them. Requiring someone to carefully scroll through the whole document to find them. I would expect to see a "Parser Messages" window with the errors after the warning that context rules are off. It only shows me this error window when I open the file itself, not when I Edit the Resolved Document, and only for some context errors, not all.


Some context errors trigger this behavior (like an extra <topic> element) but other errors do not trigger a warning, like a malformed element such as<note type="attention">attention<sometext note="> or an extra

element, which should also be context errors.


2 different translation vendors are returning invalid files to us, and we need an easy way to check a file set before production.


Thanks for the help!

Hi Bill,

Have you turned off the allowinvalidmarkup and autotaginserts options in the Editor Advanced Preferences?

David

David S. Taylor

Project Manager, Production and Marketing
Building Regulations | NRC Construction
National Research Council Canada
Building M-23A, Room 114 | 1200 Montreal Road | Ottawa, ON | K1A 0R6
Telephone: +1.613.990.2731 | Fax: +1.613.952.4040
David.S.Taylor@nrc-cnrc.gc.ca<">mailto:David.S.Taylor@nrc-cnrc.gc.ca>


Hi Bill--

Hmm, that's weird. Well, if that doesn't work, you ought to be able to do something via ACL. You can use the check_completeness command to do a check of an individual file, so then it's mainly a matter of iterating over the files referenced in a map. As a start, you could use something like this:

# WARNING: Untested code; debugging is left as an exercise
function cc_all() {
local $refs[], $ref;
oid_find_children(oid_null(), $refs, "topicref");
for ($ref in $refs) {
local $fname = oid_attr($refs[$ref],"href");
local doc = doc_open($fname, 0x20); # 0x20 = no warnings on file open
current_doc(doc);
eval "----------------------------------\nDocument $fname:\n" output=>log.txt;
cc -full output=>log.txt;
doc_close(doc);
}
}

Load your map, run this function, and it should generate a log.txt file with info about context errors in the topic files. You'll probably need to beef it up to properly handle references to submaps, keydefs, and maybe a few other things, but hopefully this gives you enough to build on to get to where you want to go.

--Clay
Liam
4-Participant
(To:Liam)

Thanks David,


Setting theparsevalidate option to off helped the problem, and appears to have the same or a similar effect as turning allowinvalidmarkup to off. Both of these options contribute to elements getting balanced automatically, and other auto-edits.


off appears to stop the automatic insertion of elements when editing, for example, when adding a

  • element, the Editor automatically adds the first
  • element, which is desirable behavior.



    " target="_BLANK">mailto:David.S.Taylor@nrc-cnrc.gc.ca>


Liam
4-Participant
(To:Liam)

Hi Clay,


The manual workaround is:



  1. to off

  2. Do a Completeness Check, so the warnings window displays all of the errors.

But your code snippet below is more like the behavior for which I'm looking. THANK YOU. I look forward to playing with this. If I can figure out how to automatically run this whenever someone opens a map or bookmap, I will have the ideal solution.


Cheers,


Bill



In Reply to Clay Helberg:


Hi Bill--

Hmm, that's weird. Well, if that doesn't work, you ought to be able to do something via ACL. You can use the check_completeness command to do a check of an individual file, so then it's mainly a matter of iterating over the files referenced in a map. As a start, you could use something like this:

# WARNING: Untested code; debugging is left as an exercise
function cc_all() {
local $refs[], $ref;
oid_find_children(oid_null(), $refs, "topicref");
for ($ref in $refs) {
local $fname = oid_attr($refs[$ref],"href");
local doc = doc_open($fname, 0x20); # 0x20 = no warnings on file open
current_doc(doc);
eval "----------------------------------\nDocument $fname:\n" output=>log.txt;
cc -full output=>log.txt;
doc_close(doc);
}
}

Load your map, run this function, and it should generate a log.txt file with info about context errors in the topic files. You'll probably need to beef it up to properly handle references to submaps, keydefs, and maybe a few other things, but hopefully this gives you enough to build on to get to where you want to go.

--Clay

Hi Bill,
Take a look at addrequiredtags, I believe this is the option that will prevent Editor from injecting missing tags into an out-of-context file.

We had problems like this in the past.

Cheers,

David

JeffStevenson
12-Amethyst
(To:Liam)

Hi Bill,


For further checking, you can also use Schematron. If you aren't familiar, Schematron allows for a deeper completeness checking for certain conditions that are reported back to the user.


-Jeff

In Reply to David Taylor:


Hi Bill,
Take a look at addrequiredtags, I believe this is the option that will prevent Editor from injecting missing tags into an out-of-context file.

We had problems like this in the past.

Cheers,

David

Liam
4-Participant
(To:Liam)

Hi Jeff,


I found schematron.acl in the AE directory structure, and looking at the comments, it appears to have the kind of function for which I'm looking. Are you aware of any references or instructions for how one might leverage this function? I didn't find much in the Customizing or Admin guides.



Thanks for the post!


Bill

Hi Bill--

Schematron is a public standard, so you should be able to find plenty of info on it around the internet. Here's one tutorial you might start with:

JeffStevenson
12-Amethyst
(To:Liam)

Hi Bill,


You can find Schematron instructions in the Arbortext Document Types Guide.


To reference a Schematron file, it just needs to be saved in your doctypes folder with the same name as the doctype. Alternatively, you can specify an alternate location in your dcf or using ACL doc_type_schematron_file() (v6.1). The Schematron will run along with "Check Completeness" and provide messages in the resulting pop-up.


Schematron itself is a well-documented standard. You shold be able to find lots of documentation online.


-Jeff



In Reply to Bill Duncan:



Hi Jeff,


I found schematron.acl in the AE directory structure, and looking at the comments, it appears to have the kind of function for which I'm looking. Are you aware of any references or instructions for how one might leverage this function? I didn't find much in the Customizing or Admin guides.



Thanks for the post!


Bill


Announcements

Top Tags