<?xml version="1.0"?>
<dmodule xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.s1000d.org/S1000D_5-0/xml_schema_flat/descript.xsd">
 <identAndStatusSection>
   <dmAddress>
     <dmIdent>
       <dmCode modelIdentCode="S1KDTOOLS" systemDiffCode="A" systemCode="09" subSystemCode="0" subSubSystemCode="0" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="040" infoCodeVariant="A" itemLocationCode="D"/>
       <language languageIsoCode="en" countryIsoCode="CA"/>
       <issueInfo issueNumber="036" inWork="00"/>
     </dmIdent>
     <dmAddressItems>
       <issueDate year="2020" month="09" day="01"/>
       <dmTitle>
         <techName>s1kd-metadata</techName>
         <infoName>Description</infoName>
       </dmTitle>
     </dmAddressItems>
   </dmAddress>
   <dmStatus issueType="changed">
     <security securityClassification="01"/>
     <responsiblePartnerCompany>
       <enterpriseName>khzae.net</enterpriseName>
     </responsiblePartnerCompany>
     <originator>
       <enterpriseName>khzae.net</enterpriseName>
     </originator>
     <applic>
       <displayText>
         <simplePara>All</simplePara>
       </displayText>
     </applic>
     <brexDmRef>
       <dmRef>
         <dmRefIdent>
           <dmCode modelIdentCode="S1KDTOOLS" systemDiffCode="A" systemCode="00" subSystemCode="0" subSubSystemCode="0" assyCode="00" disassyCode="00" disassyCodeVariant="A" infoCode="022" infoCodeVariant="A" itemLocationCode="D"/>
         </dmRefIdent>
       </dmRef>
     </brexDmRef>
     <qualityAssurance>
       <unverified/>
     </qualityAssurance>
     <reasonForUpdate id="rfu-xml-catalog" updateHighlight="1" updateReasonType="urt02">
       <simplePara>Add --xml-catalog parser option.</simplePara>
     </reasonForUpdate>
   </dmStatus>
 </identAndStatusSection>
 <content>
   <description>
     <levelledPara>
       <title>General</title>
       <para>The <emphasis>s1kd-metadata</emphasis> tool provides a simple way to fetch and change metadata on S1000D CSDB objects.</para>
     </levelledPara>
     <levelledPara>
       <title>Usage</title>
       <para>
         <verbatimText verbatimStyle="vs24">s1kd-metadata [options] [&lt;object&gt;...]</verbatimText>
       </para>
     </levelledPara>
     <levelledPara>
       <title>Options</title>
       <para>
         <definitionList>
           <definitionListItem>
             <listItemTerm>-0, --null</listItemTerm>
             <listItemDefinition>
               <para>Print a null-delimited list of values of the pieces of metadata specified with -n, or all available metadata if -n is not specified.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-c, --set &lt;file&gt;</listItemTerm>
             <listItemDefinition>
               <para>Use &lt;file&gt; to edit metadata files. &lt;file&gt; consists of lines starting with a metadata name, followed by whitespace, followed by the new value for the metadata (the program uses this same format when outputting all metadata if no &lt;name&gt; is specified).</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-d, --date-format &lt;fmt&gt;</listItemTerm>
             <listItemDefinition>
               <para>The format to use when printing dates, such as the "issueDate" or "modified" metadata. &lt;fmt&gt; should conform to the format used by strftime. The default is "%Y-%m-%d".</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-E, --editable</listItemTerm>
             <listItemDefinition>
               <para>When showing all metadata, only list editable items. This is useful when creating a file for use with the -c option.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-e, --exec &lt;cmd&gt;</listItemTerm>
             <listItemDefinition>
               <para>Execute a command for each CSDB object. The string "{}" is replaced by the current CSDB object file name everywhere it occurs in the arguments to the command.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-F, --format &lt;fmt&gt;</listItemTerm>
             <listItemDefinition>
               <para>Print a formatted line for each CSDB object. Metadata names surrounded with % (e.g. %issueDate%) will be substituted by the value read from the object.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-f, --overwrite</listItemTerm>
             <listItemDefinition>
               <para>When editing metadata, overwrite the object. The default is to output the modified object to stdout.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-H, --info</listItemTerm>
             <listItemDefinition>
               <para>Lists all available metadata with a short description of each. Specify specific metadata to describe with the -n option.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-h, -?, --help</listItemTerm>
             <listItemDefinition>
               <para>Show help/usage message.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-l, --list</listItemTerm>
             <listItemDefinition>
               <para>Treat input as a list of object filenames to read or edit metadata on, rather than an object itself.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-m, --matches &lt;regex&gt;</listItemTerm>
             <listItemDefinition>
               <para>Used after a -w or -W option, this specifies a regular expression to match the value of the given metadata against, instead of a literal value (-v).</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-n, --name &lt;name&gt;</listItemTerm>
             <listItemDefinition>
               <para>The name of the piece of metadata to fetch. This option can be specified multiple times to fetch multiple pieces of metadata. If -n is not specified, all available metadata names are printed with their values. This output can be sent to a text file, edited, and then specified with the -c option as a means of editing metadata in any text editor.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-q, --quiet</listItemTerm>
             <listItemDefinition>
               <para>Quiet mode. Non-fatal errors such as a missing piece of optional metadata in an object will not be printed to stderr.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-T, --raw</listItemTerm>
             <listItemDefinition>
               <para>Do not format columns in output.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-t, --tab</listItemTerm>
             <listItemDefinition>
               <para>Print a tab-delimited list of values of the pieces of metadata specified with -n, or all available metadata if -n is not specified.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-v, --value &lt;value&gt;</listItemTerm>
             <listItemDefinition>
               <para>When following a -n option, this specifies the new value for that piece of metadata.</para>
               <para>When following a -w or -W option, this specifies the value to compare that piece of metadata to.</para>
               <para>Each -n, -w, or -W can be followed by -v to edit or define conditions on multiple pieces of metadata.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-W, --where-not &lt;name&gt;</listItemTerm>
             <listItemDefinition>
               <para>Show or edit metadata only on objects where the value of &lt;name&gt; is not equal to the value specified in the following -v option. If no -v option follows, this will show objects which do not have metadata &lt;name&gt; of any value.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>-w, --where &lt;name&gt;</listItemTerm>
             <listItemDefinition>
               <para>Show or edit metadata only on objects where the value of &lt;name&gt; is equal to the value specified in the following -v option. If no -v option follows, this will show objects which have metadata &lt;name&gt; with any value.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>--version</listItemTerm>
             <listItemDefinition>
               <para>Show version information.</para>
             </listItemDefinition>
           </definitionListItem>
           <definitionListItem>
             <listItemTerm>&lt;object&gt;...</listItemTerm>
             <listItemDefinition>
               <para>The object(s) to show/edit metadata on. The default is to read from stdin.</para>
             </listItemDefinition>
           </definitionListItem>
         </definitionList>
       </para>
       <para>
         In addition, the following options allow configuration of the XML parser:
         <definitionList><definitionListItem><listItemTerm>--dtdload</listItemTerm><listItemDefinition><para>Load the external DTD.</para></listItemDefinition></definitionListItem><definitionListItem><listItemTerm>--huge</listItemTerm><listItemDefinition><para>Remove any internal arbitrary parser limits.</para></listItemDefinition></definitionListItem><definitionListItem><listItemTerm>--net</listItemTerm><listItemDefinition><para>Allow network access to load external DTD and entities.</para></listItemDefinition></definitionListItem><definitionListItem><listItemTerm>--noent</listItemTerm><listItemDefinition><para>Resolve entities.</para></listItemDefinition></definitionListItem><definitionListItem><listItemTerm>--parser-errors</listItemTerm><listItemDefinition><para>Emit errors from parser.</para></listItemDefinition></definitionListItem><definitionListItem><listItemTerm>--parser-warnings</listItemTerm><listItemDefinition><para>Emit warnings from parser.</para></listItemDefinition></definitionListItem><definitionListItem><listItemTerm>--xinclude</listItemTerm><listItemDefinition><para>Do XInclude processing.</para></listItemDefinition></definitionListItem><definitionListItem changeMark="1" changeType="add" reasonForUpdateRefIds="rfu-xml-catalog"><listItemTerm>--xml-catalog &lt;file&gt;</listItemTerm><listItemDefinition><para>Use an XML catalog when resolving entities. Multiple catalogs may be loaded by specifying this option multiple times.</para></listItemDefinition></definitionListItem></definitionList>
       </para>
     </levelledPara>
     <levelledPara>
       <title>Example</title>
       <para>
         <verbatimText verbatimStyle="vs24">$ ls
DMC-S1KDTOOLS-A-09-00-00-00A-040A-D_EN-CA.XML
DMC-S1KDTOOLS-A-0Q-00-00-00A-040A-D_EN-CA.XML

$ DMOD=DMC-S1KDTOOLS-A-09-00-00-00A-040A-D_EN-CA.XML
$ s1kd-metadata $DMOD
issueDate                      2017-08-14
techName                       s1kd-metadata(1) | s1kd-tools
responsiblePartnerCompany      khzae.net
originator                     khzae.net
securityClassification         01
schema                         descript
schemaUrl                      http://www.s1000d.org/S1000D_5-0/xml_
schema_flat/descript.xsd
type                           dmodule
applic                         All
brex                           S1000D-F-04-10-0301-00A-022A-D
issueType                      new
languageIsoCode                en
countryIsoCode                 CA
issueNumber                    001
inWork                         00
dmCode                         S1KDTOOLS-A-09-00-00-00A-040A-D

$ s1kd-metadata -n techName -v "New title" $DMOD
$ s1kd-metadata -n techName $DMOD
New title

$ s1kd-metadata -n techName DMC-*.XML
New title
s1kd-aspp(1) | s1kd-tools

$ s1kd-metadata -F "%techName% (%issueDate%) %issueType%" DMC-*.XML
New title (2017-08-14) new
s1kd-aspp(1) | s1kd-tools (2018-03-28) changed

$ s1kd-metadata -F "%techName%" -w subSubSystemCode -v Q DMC-*.XML
s1kd-aspp(1) | s1kd-tools

$ s1kd-metadata -n path -w subSystemCode -v Q
DMC-S1KDTOOLS-A-0Q-00-00-00A-040A-D_EN-CA.XML

$ s1kd-metadata -n path -W subSystemCode -v Q
DMC-S1KDTOOLS-A-09-00-00-00A-040A-D_EN-CA.XML

$ s1kd-metadata -n path -w subSystemCode -m [0-9]
DMC-S1KDTOOLS-A-09-00-00-00A-040A-D_EN-CA.XML</verbatimText>
       </para>
     </levelledPara>
   </description>
 </content>
</dmodule>