xref: /aosp_15_r20/external/libxml2/doc/xmlcatalog.html (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlcatalog</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmlcatalog &#8212;
2        Command line tool to parse and manipulate <acronym class="acronym">XML</acronym>
3        or <acronym class="acronym">SGML</acronym> catalog files.
4    </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmlcatalog</code>  [ <code class="option">--sgml</code>  |   <code class="option">--shell</code>  |   <code class="option">--convert</code>  |   <code class="option">--create</code>  |   <code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code>  |
5            [
6                    <code class="option">--add
7                     <em class="replaceable"><code>TYPE</code></em>
8                     <em class="replaceable"><code>ORIG</code></em>
9                     <em class="replaceable"><code>REPLACE</code></em>
10                    </code>
11                  |   <code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code> ]
12          |   <code class="option">--noout</code>  |   <code class="option">--no-super-update</code>  |
13            [ <code class="option">-v</code>  |   <code class="option">--verbose</code> ]
14         ] {<em class="replaceable"><code>CATALOGFILE</code></em>} {<em class="replaceable"><code>ENTITIES</code></em>...}</p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
15        <span class="command"><strong>xmlcatalog</strong></span> is a command line application allowing users to monitor and
16        manipulate <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> catalogs. It
17        is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.
18    </p><p>
19        Its functions can be invoked from a single command from the command line,
20        or it can perform multiple functions in interactive mode. It can operate
21        on both <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> files.
22    </p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
23        <span class="command"><strong>xmlcatalog</strong></span> accepts the following options (in alphabetical order):
24    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
25                <code class="option">--add
26                 <em class="replaceable"><code>TYPE</code></em>
27                 <em class="replaceable"><code>ORIG</code></em>
28                 <em class="replaceable"><code>REPLACE</code></em>
29                </code>
30            </span></dt><dd><p>
31                    Add an entry to <code class="filename">CATALOGFILE</code>. <em class="replaceable"><code>TYPE</code></em>
32                    indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
33                    reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
34                    is the <acronym class="acronym">URI</acronym> of the replacement entity to be
35                    used. The <code class="option">--add</code> option will not overwrite
36                    <code class="filename">CATALOGFILE</code>, outputting
37                    to <code class="filename">stdout</code>, unless
38                    <code class="option">--noout</code> is used. The <code class="option">--add</code> will
39                    always take three parameters even if some of the <acronym class="acronym">XML</acronym>
40                    catalog constructs will have only a single argument.
41                </p></dd><dt><span class="term"><code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code></span></dt><dd><p>
42                    If the <code class="option">--add</code> option is used following
43                    the <code class="option">--sgml</code> option, only a single argument,
44                    a <em class="replaceable"><code>FILENAME</code></em>, is used. This is used to add
45                    the name of a catalog file to an <acronym class="acronym">SGML</acronym> supercatalog,
46                    a file that contains references to other included <acronym class="acronym">SGML</acronym>
47                    catalog files.
48                </p></dd><dt><span class="term"><code class="option">--convert</code></span></dt><dd><p>
49                    Convert SGML catalog to XML.
50                </p></dd><dt><span class="term"><code class="option">--create</code></span></dt><dd><p>
51                    Create a new <acronym class="acronym">XML</acronym> catalog. Outputs
52                    to <code class="filename">stdout</code>,
53                    ignoring <em class="replaceable"><code>filename</code></em> unless <code class="option">--noout</code> is
54                    used, in which case it creates a new catalog
55                    file <em class="replaceable"><code>filename</code></em>.
56                </p></dd><dt><span class="term"><code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
57                    Remove entries from <em class="replaceable"><code>CATALOGFILE</code></em>
58                    matching <em class="replaceable"><code>VALUE(S)</code></em>. The <code class="option">--del</code>
59                    option will not overwrite <em class="replaceable"><code>CATALOGFILE</code></em>,
60                    outputting to <code class="filename">stdout</code>,
61                    unless <code class="option">--noout</code> is used.
62                </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
63                    Save output to the named file rather than outputting
64                    to <code class="filename">stdout</code>.
65                </p></dd><dt><span class="term"><code class="option">--no-super-update</code></span></dt><dd><p>
66                    Do not update the <acronym class="acronym">SGML</acronym> super catalog.
67                </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
68                    Run a shell allowing interactive queries on catalog
69                    file <em class="replaceable"><code>CATALOGFILE</code></em>. For the set of available
70                    commands see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>.
71                </p></dd><dt><span class="term"><code class="option">--sgml</code></span></dt><dd><p>
72                    Uses <acronym class="acronym">SGML</acronym> super catalogs for <code class="option">--add</code>
73                    and <code class="option">--del</code> options.
74                </p></dd><dt><span class="term"><code class="option">-v</code>, </span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>Output debugging information.</p></dd></dl></div><p>
75        Invoking <span class="command"><strong>xmlcatalog</strong></span> non-interactively without a designated action
76        (imposed with options like <code class="option">--add</code>) will result in a lookup
77        of the catalog entry for <em class="replaceable"><code>ENTITIES</code></em> in the
78        catalog denoted with <em class="replaceable"><code>CATALOGFILE</code></em>. The
79        corresponding entries will be output to the command line. This mode of
80        operation, together with <code class="option">--shell</code> mode and non-modifying
81        (i.e. without <code class="option">--noout</code>) direct actions, allows for
82        a special shortcut of the void <em class="replaceable"><code>CATALOGFILE</code></em>
83        specification (possibly expressed as "" in the shell
84        environment) appointing the default system catalog. That simplifies the
85        handling when its exact location is irrelevant but the respective built-in
86        still needs to be consulted.
87    </p></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
88        Invoking <span class="command"><strong>xmlcatalog</strong></span> with
89        the <code class="option">--shell <em class="replaceable"><code>CATALOGFILE</code></em></code> option opens
90        a command line shell allowing interactive access to the catalog file
91        identified by <em class="replaceable"><code>CATALOGFILE</code></em>. Invoking the shell
92        provides a command line prompt after which the following commands (described in
93        alphabetical order) can be entered.
94    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
95                <code class="option">add
96                 <em class="replaceable"><code>TYPE</code></em>
97                 <em class="replaceable"><code>ORIG</code></em>
98                 <em class="replaceable"><code>REPLACE</code></em>
99                </code>
100            </span></dt><dd><p>
101                    Add an entry to the catalog file. <em class="replaceable"><code>TYPE</code></em>
102                    indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
103                    reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
104                    is the <acronym class="acronym">URI</acronym> of the replacement entity to be
105                    used. The <code class="option">--add</code> option will not overwrite
106                    <code class="filename">CATALOGFILE</code>, outputting
107                    to <code class="filename">stdout</code>, unless
108                    <code class="option">--noout</code> is used. The <code class="option">--add</code> will
109                    always take three parameters even if some of the <acronym class="acronym">XML</acronym>
110                    catalog constructs will have only a single argument.
111                </p></dd><dt><span class="term"><code class="option">debug</code></span></dt><dd><p>
112                    Print debugging statements showing the steps <span class="command"><strong>xmlcatalog</strong></span> is executing.
113                </p></dd><dt><span class="term"><code class="option">del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
114                    Remove the catalog entry corresponding to <em class="replaceable"><code>VALUE(S)</code></em>.
115                </p></dd><dt><span class="term"><code class="option">dump</code></span></dt><dd><p>Print the current catalog.</p></dd><dt><span class="term"><code class="option">exit</code></span></dt><dd><p>Quit the shell.</p></dd><dt><span class="term"><code class="option">public <em class="replaceable"><code>PUBLIC-ID</code></em></code></span></dt><dd><p>
116                    Execute a Formal Public Identifier lookup of the catalog entry
117                    for <em class="replaceable"><code>PUBLIC-ID</code></em>. The corresponding entry will be
118                    output to the command line.
119                </p></dd><dt><span class="term"><code class="option">quiet</code></span></dt><dd><p>Stop printing debugging statements.</p></dd><dt><span class="term"><code class="option">system <em class="replaceable"><code>SYSTEM-ID</code></em></code></span></dt><dd><p>
120                    Execute a Formal Public Identifier lookup of the catalog entry
121                    for <em class="replaceable"><code>SYSTEM-ID</code></em>. The corresponding entry will be
122                    output to the command line.
123                </p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
124                    queries to the user's own set of catalogs. This can be done by setting
125                    the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
126                    list of catalogs. Use percent-encoding to escape spaces or other characters.
127                    An empty variable should deactivate loading the default catalog from
128                    <code class="filename">/etc/xml/catalog</code> or, more specifically,
129                    <code class="filename">${sysconfdir}/xml/catalog</code>.
130                </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
131        <span class="command"><strong>xmlcatalog</strong></span> return codes provide information that can be used when
132        calling it from scripts.
133    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Failed to remove an entry from the catalog</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Failed to save to the catalog, check file permissions</p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Failed to add an entry to the catalog</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Failed to look up an entry in the catalog</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
134    </p><p>
135        More information can be found at
136        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/GNOME/libxml2</a>
137                </p></li><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> catalog support web page
138                    at <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support" target="_top">https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support</a>
139                </p></li><li class="listitem"><p>James Clark's <acronym class="acronym">SGML</acronym> catalog
140                    page <a class="ulink" href="http://www.jclark.com/sp/catalog.htm" target="_top">http://www.jclark.com/sp/catalog.htm</a>
141                </p></li><li class="listitem"><p><acronym class="acronym">OASIS</acronym> <acronym class="acronym">XML</acronym> catalog specification
142                    <a class="ulink" href="http://www.oasis-open.org/committees/entity/spec.html" target="_top">http://www.oasis-open.org/committees/entity/spec.html</a>
143                </p></li></ul></div><p>
144    </p></div></div></body></html>
145