.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "s1kd-brexcheck" "1" "2024-03-21" "" "s1kd-tools" .hy .SH NAME .PP s1kd-brexcheck - Validate S1000D CSDB objects against BREX data modules .SH SYNOPSIS .IP .nf \f[C] s1kd-brexcheck [-b ] [-d ] [-I ] [-w ] [-X ] [-F|-f] [-BceLlNnopqrS[tu]sTvx\[ha]h?] [...] \f[R] .fi .SH DESCRIPTION .PP The \f[I]s1kd-brexcheck\f[R] tool validates S1000D CSDB objects using the context, SNS, and/or notation rules of one or multiple Business Rules EXchange (BREX) data modules. All errors are displayed with the message, the line number, and a representation of the invalid XML tree. .SH OPTIONS .TP -B, --default-brex Check each input object against the appropriate built-in S1000D default BREX only. The actual BREX reference of each object is ignored. .TP -b, --brex Check the CSDB objects against this BREX. Multiple BREX data modules can be specified by adding this option multiple times. When no BREX data modules are specified, the BREX data module referenced in in the CSDB object is attempted to be used instead. .TP -c, --values When a context rule defines values for an object (objectValue), check if the value of each object is within the allowed set of values. .TP -d, --dir Directory to start searching for BREX data modules in. By default, the current directory is used. .TP -e, --ignore-empty Ignore check for empty or non-XML documents. .TP -F, --valid-filenames Print the filenames of CSDB objects with no BREX/SNS errors. .TP -f, --filenames Print the filenames of CSDB objects with BREX/SNS errors. .TP -h, -?, --help Show the help/usage message. .TP -I, --include Add a search path for BREX data modules. By default, only the current directory is searched. .TP -L, --list Treat input as a list of object filenames to check, rather than an object itself. .TP -l, --layered Use the layered BREX concept. BREX data modules referenced by other BREX data modules (either specified with -b or referenced by the specified CSDB objects) will also be checked against. .TP -N, --omit-issue Assume that the issue/inwork numbers are omitted from object filenames (they were created with the -N option). .TP -n, --notations Check notation rules. Any notation names listed in any of the BREX data modules with attribute \f[C]allowedNotationFlag\f[R] set to \[dq]1\[dq] or omitted are considered valid notations. If a notation in a CSDB object is not present or has \f[C]allowedNotationFlag\f[R] set to \[dq]0\[dq], an error will be returned. .RS .PP For notations not included but not explicitly excluded, the \f[C]objectUse\f[R] of the first inclusion rule will be returned with the error. For explicitly excluded notations, the \f[C]objectUse\f[R] of the explicit exclusion rule is returned. .RE .TP -o, --output-valid Output valid CSDB objects to stdout. .TP -p, --progress Display a progress bar. .TP -q, --quiet Quiet mode. No errors are printed, they are only indicated via the exit status. .TP -r, --recursive Search for BREX data modules recursively. .TP -S[tu], --sns [--strict|--unstrict] Check Standard Numbering System (SNS) rules. The SNS of each specified data module is checked against the combination of all SNS rules of all specified BREX data modules. .TP -s, --short Use shortened, single-line messages to report BREX errors instead of multiline indented messages. .TP -T, --summary Print a summary of the check after it completes, including statistics on the number of documents that passed/failed the check. .TP -v, --verbose Verbose mode. The success or failure of each test is printed explicitly. .TP -w, --severity-levels Specify a list of severity levels for business rules. .TP -X, --xpath-version Force the specified version of XPath to be used when evaluating the object paths of BREX rules. .TP -x, --xml Output an XML report. .TP -\[ha], --remove-deleted Check the CSDB objects with elements that have a change type of \[dq]delete\[dq] removed. .TP --version Show version information. .TP --zenity-progress Print progress information in the zenity --progress format. .PP In addition, the following options allow configuration of the XML parser: .TP --dtdload Load the external DTD. .TP --huge Remove any internal arbitrary parser limits. .TP --net Allow network access to load external DTD and entities. .TP --noent Resolve entities. .TP --parser-errors Emit errors from parser. .TP --parser-warnings Emit warnings from parser. .TP --xinclude Do XInclude processing. .TP --xml-catalog Use an XML catalog when resolving entities. Multiple catalogs may be loaded by specifying this option multiple times. .SS Business rule severity levels (\f[C].brseveritylevels\f[R]) .PP The attribute \f[C]brSeverityLevel\f[R] on a BREX rule allows for distinguishing different kinds of errors. The \f[C].brseveritylevels\f[R] file contains a list of severity levels, their user-defined type, and optionally if they should not be counted as true errors (causing the tool to return a \[dq]failure\[dq] status) but merely warnings. .PP By default, the program will search the current directory and parent directories for a file named \f[C].brseveritylevels\f[R], but any file can be specified by using the -w option. .PP An example of the format of this file is given below: .IP .nf \f[C] Error Warning \f[R] .fi .PP When the attribute \f[C]fail\f[R] has a value of \f[C]\[dq]yes\[dq]\f[R] (or is not included), BREX errors pertaining to rules with the given severity level value will be counted as errors. When it is \f[C]\[dq]no\[dq]\f[R], the errors are still displayed but are not counted as errors in the exit status code of the tool. .SS Normal, strict and unstrict SNS check (-S, -St, -Su) .PP There are three modes for SNS checking: normal, strict, and unstrict. The main difference between them is how they handle the optional levels of an SNS description in the BREX. .PP -St enables \f[I]strict\f[R] SNS checking. By default, the normal SNS check (-S) will assume optional elements snsSubSystem, snsSubSubSystem, and snsAssy exist with an snsCode of \[dq]0\[dq] (\[dq]00\[dq] or \[dq]0000\[dq] for snsAssy) when their parent element does not contain any of each. This provides a shorthand, such that .IP .nf \f[C] 00 General \f[R] .fi .PP is equivalent to .IP .nf \f[C] 00 General 0 General 0 General 00 General \f[R] .fi .PP Using strict checking will disable this shorthand, and missing optional elements will result in an error. .PP -Su enables \f[I]unstrict\f[R] SNS checking. The normal SNS check (-S) shorthand mentioned above only allows SNS codes of \[dq]0\[dq] to be omitted from the SNS rules. Using unstrict checking, \f[I]any\f[R] code used will not produce an error when the relevant optional elements are omitted. This means that given the following... .IP .nf \f[C] 00 General \f[R] .fi .PP \&...SNS codes of 00-00-0000 through 00-ZZ-ZZZZ are considered valid. .SS Object value checking (-c) .PP There are two ways to restrict the allowable values of an object in a BREX rule. One is to use the XPath expression itself. For example, this expression will match any \f[C]securityClassification\f[R] attribute whose value is neither \f[C]\[dq]01\[dq]\f[R] nor \f[C]\[dq]02\[dq]\f[R], and because the \f[C]allowedObjectFlag\f[R] is \f[C]\[dq]0\[dq]\f[R], will generate a BREX error if any match is found: .IP .nf \f[C] //\[at]securityClassification[ \&. != \[aq]01\[aq] and \&. != \[aq]02\[aq] ] \f[R] .fi .PP However, this method can lead to fairly complex expressions and requires a reversal of logic. The BREX schema provides an alternative method using the element \f[C]objectValue\f[R]: .IP .nf \f[C] //\[at]securityClassification Unclassified Classified \f[R] .fi .PP Specifying the -c option will enable checking of these types of rules, and if the value is not within the allowed set a BREX error will be reported. The \f[C]valueForm\f[R] attribute can be used to specify what kind of notation the \f[C]valueAllowed\f[R] attribute will contain: .IP \[bu] 2 \f[C]\[dq]single\[dq]\f[R] - A single, exact value. .IP \[bu] 2 \f[C]\[dq]range\[dq]\f[R] - Values given in the S1000D range/set notation, e.g. \f[C]\[dq]a\[ti]c\[dq]\f[R] or \f[C]\[dq]a|b|c\[dq]\f[R]. .IP \[bu] 2 \f[C]\[dq]pattern\[dq]\f[R] - A regular expression. .PP The s1kd-brexcheck tool supports all three types. If the \f[C]valueForm\f[R] attribute is omitted, it will assume the value is in the \f[C]\[dq]single\[dq]\f[R] notation. .SS XPath support .PP By default, s1kd-brexcheck supports only XPath 1.0, with partial support for EXSLT functions. .PP If experimental XPath 2.0 support is enabled at compile-time, s1kd-brexcheck will automatically choose a version of XPath based on the S1000D issue of the BREX data module: .TP 3.0 and lower XPath 1.0 .TP 4.0 and up XPath 2.0 .PP The -X (--xpath-version) option can be specified to force a particular version of XPath to be used regardless of issue. Information on which XPath versions are supported can be obtained from the --version option. .PP If the XPath given for the \f[C]\f[R] of a rule is invalid, the rule will be ignored when validating objects. A warning will be printed to stderr, and the XML report will contain an \f[C]\f[R] element for each error. .SH EXIT STATUS .TP 0 Check completed successfully, and no CSDB objects had BREX errors. .TP 1 Check completed successfully, but some CSDB objects had BREX errors. .TP 2 One or more CSDB objects specified could not be read. .TP 3 A referenced BREX data module could not be found. .TP 4 The XPath version specified is unsupported. .TP 5 The number of paths or CSDB objects specified exceeded the available memory. .SH EXAMPLE .IP .nf \f[C] $ DMOD=DMC-EX-A-00-00-00-00A-040A-D_000-01_EN-CA.XML $ BREX=DMC-S1000D-G-04-10-0301-00A-022A-D_001-00_EN-US.XML $ cat $DMOD [...] List items shouldn\[aq]t be used as steps... [...] Refer to . [...] $ s1kd-brexcheck -b $BREX $DMOD BREX ERROR: DMC-EX-A-00-00-00-00A-040A-D_000-01_EN-CA.XML BREX: DMC-S1000D-G-04-10-0301-00A-022A-D_001-00_EN-US.XML BREX-S1-00052 Only when the reference target is a step can the value of attribute internalRefTargetType be irtt08 (Chap 3.9.5.2.1.2, Para 2.1). line 52 (/dmodule[1]/content[1]/description[1]/para[2]/ internalRef[1]): ELEMENT internalRef ATTRIBUTE internalRefTargetType TEXT content=irtt08 ATTRIBUTE internalRefId TEXT content=stp-0001 \f[R] .fi .PP Example of XML report format for the above: .IP .nf \f[C] ... Only when the refernce target is a step can the value of attribute internalRefTargetType be irtt08 (Chap 3.9.5.2.1.2, Para 2.1). \f[R] .fi .SH AUTHORS khzae.net.