.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "s1kd-icncatalog" "1" "2021-04-16" "" "s1kd-tools" .hy .SH NAME .PP s1kd-icncatalog - Manage the catalog used to resolve ICNs .SH SYNOPSIS .IP .nf \f[C] s1kd-icncatalog [options] [...] \f[R] .fi .SH DESCRIPTION .PP The \f[I]s1kd-icncatalog\f[R] tool is used to manage a catalog of ICNs for a project, and to resolve ICNs using this catalog. Resolving an ICN means placing the actual filename of the ICN in to the SYSTEM ID of the ENTITY declaration within CSDB objects. .SH OPTIONS .TP -a, --add Add an ICN to the catalog. Follow with the -u and -n options to specify the URI and notation to use for this ICN. The -m option specifies a media group to add the ICN to. .TP -C, --create Create a new empty catalog. .TP -c, --catalog Specify the catalog file to manage or resolve against. By default, the file \f[C].icncatalog\f[R] in the current directory is used. If the current directory does not contain this file, the parent directories will be searched. .TP -d, --del Delete an ICN from the catalog. The -m option specifies a media group to delete the ICN from. .TP -f, --overwrite Overwrite the input CSDB objects when resolving ICNs, or overwrite the catalog file when modifying it. Otherwise, output is written to stdout. .TP -h, -?, --help Show help/usage message. .TP -l, --list Treat input (stdin or arguments) as lists of filenames of CSDB objects, rather than CSDB objects themselves. .TP -m, --media Resolve ICNs for this intended output media. The catalog may contain alternative formats for the same ICN to be used for different output media. .TP -n, --ndata Specify the notation to reference when adding an ICN with the -a option. .TP -q, --quiet Quiet mode. Errors are not printed. .TP -t, --type Specify the type of catalog entry when adding an ICN with the -a option. .TP -u, --uri Specify the URI when adding an ICN with the -a option. .TP -v, --verbose Verbose output. .TP --version Show version information. .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. .SH EXAMPLES .SS Resolving ICNs to filenames .PP A CSDB object may reference an ICN as follows: .IP .nf \f[C] \f[R] .fi .PP The SYSTEM ID of this ENTITY indicates that the ICN file will be in the same directory relative to the CSDB object. However, the ICN files in this example are located in a separate folder called \[aq]graphics\[aq]. Rather than manually updating every ENTITY declaration in every CSDB object, a catalog file can be used to map ICNs to actual filenames: .IP .nf \f[C] \f[R] .fi .PP Then, using this tool, the ICN can be resolved against the catalog: .IP .nf \f[C] $ s1kd-icncatalog -c \f[R] .fi .PP Producing the following output: .IP .nf \f[C] \f[R] .fi .SS Alternative ICN formats .PP A catalog can also be used to provide alternative file formats for an ICN depending on the intended output media. For example: .IP .nf \f[C] \f[R] .fi .PP The -m option allows for specifying which type of media to resolve for: .IP .nf \f[C] \f[R] .fi .IP .nf \f[C] $ s1kd-icncatalog -c -m pdf \f[R] .fi .IP .nf \f[C] \f[R] .fi .IP .nf \f[C] $ s1kd-icncatalog -c -m web \f[R] .fi .IP .nf \f[C] \f[R] .fi .SS Reconstructing ICN entity declarations .PP Some processing, such as XSL transformations, may remove the DTD and external entity declarations as part of parsing an XML CSDB object. A catalog can be used to restore the necessary external entity declarations afterwards. For example: .IP .nf \f[C] $ xsltproc ex.xsl \f[R] .fi .PP The resulting XML will not include a DTD or the external entity declarations for the ICNs referenced in the object, so it will not be valid according to the S1000D schema: .IP .nf \f[C] $ xsltproc ex.xsl | s1kd-validate -:49:element graphic: Schemas validity error: Element \[aq]graphic\[aq], attribute \[aq]infoEntityIdent\[aq]: \[aq]ICN-12345-00001-001-01\[aq] is not a valid value of the atomic type \[aq]xs:ENTITY\[aq]. \f[R] .fi .PP Passing the result to this tool, with a catalog containing all the ICNs used by the project: .IP .nf \f[C] $ xsltproc ex.xsl | s1kd-icncatalog -c \f[R] .fi .PP will reconstruct the required external entity declarations in the DTD. .PP The s1kd-tools will copy the DTD and external entity declarations automatically when performing transformations, so this is only necessary when using more generic XML tools. .SS ICN pattern rules .PP By default, each catalog entry matches a single ICN, but multiple ICNs can be resolved with a single entry by using a pattern rule. An entry with attribute \f[C]type=\[dq]pattern\[dq]\f[R] specifies a regular expression to use to match ICNs and a template used to construct the resolved URI: .IP .nf \f[C] \f[R] .fi .PP The above entry would match a series of CAGE-based ICNs, resolving them to a subfolder of \[aq]graphics\[aq] based on their CAGE code. Using this entry, the following input: .IP .nf \f[C] ]> \f[R] .fi .PP would be resolved as follows: .IP .nf \f[C] ]> \f[R] .fi .PP The regular expressions must conform to the extended POSIX regular expression syntax. Backreferences \[rs]1 through \[rs]9 can be used in the URI template to substitute captured groups. .SH CATALOG SCHEMA .PP The following describes the schema of an ICN catalog file. .SS Catalog .PP \f[I]Markup element:\f[R] \f[C]\f[R] .PP \f[I]Attributes:\f[R] .IP \[bu] 2 None .PP \f[I]Child elements:\f[R] .IP \[bu] 2 \f[C]\f[R] .IP \[bu] 2 \f[C]\f[R] .IP \[bu] 2 \f[C]\f[R] .SS Notation .PP The element \f[C]\f[R] represents a NOTATION declaration. .PP \f[I]Markup element:\f[R] \f[C]\f[R] .PP \f[I]Attributes:\f[R] .IP \[bu] 2 \f[C]name\f[R], the NDATA name. .IP \[bu] 2 \f[C]publicId\f[R], the optional PUBLIC ID of the notation. .IP \[bu] 2 \f[C]systemId\f[R], the optional SYSTEM ID of the notation. .PP \f[I]Child elements:\f[R] .IP \[bu] 2 None .SS Media .PP The element \f[C]\f[R] groups a set of alternative ICN formats for a particular output media type. .PP \f[I]Markup element:\f[R] \f[C]\f[R] .PP \f[I]Attributes:\f[R] .IP \[bu] 2 \f[C]name\f[R], the identifier of the output media. .PP \f[I]Child elements:\f[R] .IP \[bu] 2 \f[C]\f[R] .SS ICN .PP The element \f[C]\f[R] maps an ICN to a filename and optionally a notation. When this element occurs as a child of a \f[C]\f[R] element, it will be used when that output media is specified with the -m option. When it occurs as a child of \f[C]\f[R], it will be used if no media is specified. .PP \f[I]Markup element:\f[R] \f[C]\f[R] .PP \f[I]Attributes:\f[R] .IP \[bu] 2 \f[C]type\f[R], the type of ICN entry, with one of the following values: .RS 2 .IP \[bu] 2 \f[C]\[dq]single\[dq]\f[R] (D) - Specifies a single ICN to resolve. .IP \[bu] 2 \f[C]\[dq]pattern\[dq]\f[R] - Specifies a pattern to resolve one or more ICNs. .RE .IP \[bu] 2 \f[C]infoEntityIdent\f[R], the ICN, or pattern used to match ICNs. .IP \[bu] 2 \f[C]uri\f[R], the filename the ICN will resolve to. .IP \[bu] 2 \f[C]notation\f[R], a reference to a previously declared \f[C]\f[R] element. .PP \f[I]Child elements:\f[R] .IP \[bu] 2 None .SS Example ICN catalog .IP .nf \f[C] \f[R] .fi .SH AUTHORS khzae.net.