1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
|
<html>
<head>
<title>dtdview 0.5.1</title>
</head>
<body>
<!-- =================================================================== -->
<hr>
<h1>dtdview</h1>
<p><code>dtdview</code> is an interactive
<a href="http://www.sil.org/sgml/sgml.html">SGML</a>
<em>document type definition</em> (DTD)
querying tool.
<code>dtdview</code> provides a command-line interface to access
element content rules, element attributes, and navigate the structure
of a DTD.
</p>
<!-- =================================================================== -->
<hr>
<h2><a name="description">Description</a></h2>
<p>When <code>dtdview</code> is invoked, it provides a command-line
interface to access the information defined in a DTD. When
<code>dtdview</code> is started without an initial DTD to read, the
following prompt will appear:
</p>
<pre>
(dtdview) ->
</pre>
<p>If an initial DTD was specified, the prompt will look like
the following:
</p>
<pre>
(mydtd) ->
</pre>
<p>The string in the "()" will contain the name of the DTD.
</p>
<p>See <a href="#usage">Usage</a> on how to invoke <code>dtdview</code>
from your shell command-line.
See <a href="#syntax">Command Syntax</a> on how to
invoke <code>dtdview</code> commands. See
<a href="#commands">Commands</a> for a list of all
<code>dtdview</code> commands available.
</p>
<!-- =================================================================== -->
<hr>
<h2><a name="usage">Usage</a></h2>
<p><code>dtdview</code> is invoked from the shell as follows:
</p>
<p><tt>% dtdview </tt>[<var><options></var>]
[<var><filename></var>]
</p>
<p>If <var><filename></var> is given, <code>dtdview</code>
will automatically load <var><filename></var> as the initial
DTD.
</p>
<p>The following are the list of options available:
</p>
<dl>
<!-- @(#) catopt.mod 1.1 96/09/30 @(#)
-->
<dt><a name="-catalog"><code>-catalog</code> <var>filename</var></a></dt>
<dd><p>Use <var>filename</var> as the file for mapping public
identifiers and external entities to system files. If
<code>-catalog</code> is not specified, "<code>catalog</code>" is
used as the default filename.
See
<a href="#resolving">Resolving External Entities</a> for more
information.
</p>
</dd>
<dt><a name="-help"><code>-help</code></a></dt>
<dd><p>Print a brief usage description. No other action is performed.
</p>
</dd>
<dt><a name="-verbose"><code>-verbose</code></a></dt>
<dd><p>Print parsing information if a DTD is specified on the
command-line.
</p>
</dd>
</dl>
<h3>Batch Mode</h3>
<p>If standard input is not the terminal, <code>dtdview</code>
will run in batch mode. <code>dtdview</code> will execute each
command from the input without prompting. Any line of the input
beginning with a '<code>#</code>' will be ignored. <code>dtdview</code>
will still generate output as normal.
</p>
<p>Batch mode operation allows you to create scripts to automate
repeating tasks. The following example script will generate
a full listing of all elements' content models and attributes to
a file called "<code>dtdreport.txt</code>":
</p>
<pre>
# Script to generate a report off all elements of a dtd.
#
# List all elements in a single column and save to a temp file.
#
elements 1 > ,tmpfile
#
# Remove report file if it exists.
#
system /bin/rm dtdreport.txt
#
# Call perl to edit temp file to create legal dtdview commands
#
system perl -p -i -e 's/\s*(\S+)\s*/content $1 >> dtdreport.txt\nattributes $1 >> dtdreport.txt\n/' ,tmpfile
#
# Source temp file
#
source ,tmpfile
#
# Remove temp file
#
system /bin/rm ,tmpfile
#
# End of script
</pre>
<p>If the script is called "<code>report.dvs</code>", the following can be
used to run the script on a DTD:
</p>
<pre>
dtdview mydtd.dtd < report.dvs
</pre>
<!-- =================================================================== -->
<hr>
<h2><a name="syntax">Command Syntax</a></h2>
<p>The following notation is used for syntax diagrams:
</p>
<dl>
<dt>|</dt>
<dd><p>Or connector. Used to separate a list of choices.
</p>
</dd>
<dt>[ ]</dt>
<dd><p>Optional. Anything surrounded by [ ]'s is optional.
</p>
</dd>
<dt><var>< ></var></dt>
<dd><p>Variable value. Anything in < >'s represents a value that
can vary.
</p>
</dd>
<dt>" "</dt>
<dd><p>Literal text. Anything in " "'s is taken as-is.
</p>
</dd>
</dl>
<p>The following is the general syntax for all <code>dtdview</code>
commands:
<p><var><command></var> [<var><options></var>]
[
[
[ "<code>></code>" | "<code>>></code>" ] <var><filename></var> ]
|
[ "<code>|</code>" <var><program></var> ]
]
</p>
<p>In sum, <code>dtdview</code> commands may have some options to
control the behavior of the command. Any command may be redirected
to a file, or piped into another program.
</p>
<p>Here's an example of a command that prints the content model of
the element <code>CHAPTER</code>:
</p>
<pre>
(dtdview) -> content chapter
</pre>
<p>Here's an example of a command that prints all the elements
defined in the DTD and redirects the output to a file:
<pre>
(dtdview) -> elements > element.lst
</pre>
<p>If the output is to be appended to a file, use "<code>>></code>".
</p>
<p>Here's an example of a command that prints all the elements
defined in the DTD at pipes the output to <code>more</code>(1) to
allow the output to be paged one screenful at a time:
<pre>
(dtdview) -> elements | more
</pre>
<h3>Syntax Notes</h3>
<ul>
<li><p>An entire command name does not need to be entered to invoke
a command. As long as the unambiguous prefix is entered,
<code>dtdview</code> will automatically determine the proper
command to invoke.
</p>
</li>
<li><p>For commands that take element names as arguments, an element
can be designated by its unambiguous prefix.
<code>dtdview</code> will automatically determine the proper
full element name.
</p>
</li>
</ul>
<!-- =================================================================== -->
<hr>
<h2><a name="commands">Commands</a></h2>
<p>The commands listed are divided into three catagories:
</p>
<ul>
<li><a href="#data-access-cmds">Data access commands</a></li>
<li><a href="#path-cmds">Hierarchical path commands</a></li>
<li><a href="#util-cmds">Utility commands</a></li>
</ul>
<h3><a name="data-access-cmds">Data access commands</a></h3>
<p>The following commands allow to access the data defined in the DTD.
</p>
<dl>
<dt><code>attributes</code> [<var><elem></var>] </dt>
<dd><p>List the attributes of <var><elem></var>. If
<var><elem></var> is not specified, the attributes of the
last element in the hierarchical path are listed.
</p>
</dd>
<dt><code>base</code> [<var><elem></var>] </dt>
<dd><p>Output the base content model of <var><elem></var>.
If <var><elem></var> is not specified, then the base content model
of the last element in the hierarchical path is listed.
</p>
</dd>
<dt><code>content</code> [<var><elem></var>] </dt>
<dd><p>Output the full content model of <var><elem></var>.
If <var><elem></var>] is not specified, then the effective
content model (including inherited exceptions) of the last element in the
hierarchical path is listed.
</p>
</dd>
<dt><code>elements</code>
[<var><col></var> [<var><width></var>] ] </dt>
<dd><p>List all elements defined in the DTD. The optional
<var><col></var> argument specifies the number of columns
to use in the output. The <var><width></var> argument
specifies the width of the columns. If no <var><col></var>
and <var><width></var> arguments are specified,
<code>dtdview</code> will automatically determine columns and
column widths.
</p>
</dd>
<dt><code>exc</code> [<var><elem></var>] </dt>
<dd><p>List exclusion defined for <var><elem></var>.
If <var><elem></var> is not specified,
then the exclusions defined for the last element in
the hierarchical path are listed.
</p>
</dd>
<dt><code>inc</code> [<var><elem></var>] </dt>
<dd><p>List inclusion defined for <var><elem></var>.
If <var><elem></var> is not specified,
then the inclusions defined for the last element in
the hierarchical path are listed.
</p>
</dd>
<dt><code>parents</code>
[<var><elem></var>
[<var><col></var> [<var><width></var>] ] ]</dt>
<dd><p>List all possible parents of <var><elem></var>.
If <var><elem></var> is not specified,
then the parents for the last element in the
hierarchical path are listed.
</p>
<p>The optional
<var><col></var> argument specifies the number of columns
to use in the output. The <var><width></var> argument
specifies the width of the columns. If no <var><col></var>
and <var><width></var> arguments are specified,
<code>dtdview</code> will automatically determine columns and
column widths.
</p>
</dd>
<dt><a name="topcmd"><code>top</code></a></dt>
<dd><p>List top-most elements defined in the DTD.
</p>
</dd>
<dt><code>tree</code> <var><elem></var> [<var><depth></var>] </dt>
<dd><p>Print content tree of <var><elem></var> with an optional
depth of <var><depth></var>. Depth level of 2 is the default.
</p>
</dd>
</dl>
<h3><a name="path-cmds">Hierarchical path commands</a></h3>
<dl>
<dt><code>down</code> <var><elem></var> <br>
<code>down</code>
<var><elem></var> "<code>,</code>" <var><elem></var> "<code>,</code>" ...
</dt>
<dd><p>Move down the hierarchical path to <var><elem></var>.
A comma separated list (with no whitespace) of elements may be specified
to go down
the path represented by the list.
</p>
</dd>
<dt><a name="rootcmd"><code>root</code> [<var><elem></var>]</a></dt>
<dd><p>Set the root of the hierarchical path to <var><elem></var>.
If <var><elem></var> is not specified, the current root is listed.
</p>
</dd>
<dt><code>up</code> [<var><#></var>] </dt>
<dd><p>Move up <var><#></var> elements in the hierarchical path.
If <var><#></var> is not specified, 1 is used.
</p>
</dd>
<dt><code>where</code> </dt>
<dd><p>Print the current hierarchical path.
</p>
</dd>
</dl>
<h3><a name="util-cmds">Utility commands</a></h3>
<dl>
<dt><code>catalog</code> <var><filename></var> </dt>
<dd><p>Read catalog <var><filename></var>.
See
<a href="#resolving">Resolving External Entities</a> for more
information.
</p>
</dd>
<dt><code>cd</code> <var><path></var> </dt>
<dd><p>Change the current working directory to <var><path></var>.
This command is a convience function to simplify the interactive
loading of DTDs and catalogs.
</p>
</dd>
<dt><code>dtd</code> <var><filename></var>
[ "<code>0</code>" | "<code>1</code>" ] </dt>
<dd><p>Read the DTD specified by <var><filename></var>.
An optional 0 or 1 may be specified to set the verbosity.
A 1 will cause output to be generated as the DTD is parsed.
A <a href="#resetcmd"><code>reset</code></a> is done before
<var><filename></var> is read.
</p>
<p>Once the DTD is loaded, <code>dtdview</code> will automatically
set the <a href="#rootcmd">root</a> to the
<a href="#topcmd">top</a> element in the
DTD. If multiple top elements exists, the first one in alphabetical
order is chosen.
</p>
</dd>
<dt><code>exit</code> </dt>
<dd><p>Exit the program.
</p>
</dd>
<dt><code>help</code> [<var><command></var>] </dt>
<dd><p>Give listing of all commands available. If
<var><command></var> is specified, a brief usage description
will be given for <var><command></var>.
</p>
</dd>
<dt><code>ls</code>
<dd><p>List files in current working directory. The output is
similar to the Unix command "<code>ls -ACF</code>".
This command is a convience function to simplify the interactive
loading of DTDs and catalogs.
</p>
</dd>
<dt><code>quit</code>
<dd><p>Quit the program.
</p>
</dd>
<dt><a name="resetcmd"><code>reset</code></a>
<dd><p>Reset <code>dtdview</code> to start-up state with no DTD loaded.
</p>
</dd>
<dt><code>source</code> <var><filename></var> </dt>
<dd><p>Process commands listed in <var><filename></var>.
</p>
</dd>
<dt><code>system</code> <var><shell_command></var> </dt>
<dd><p>Invoke <var><shell_command></var>.
</p>
</dd>
<dt><code>version</code> </dt>
<dd><p>List version information of <code>dtdview</code>.
</p>
</dd>
</dl>
<!-- =================================================================== -->
<!-- @(#) resents.mod 1.1 96/10/05 @(#)
-->
<hr>
<h2><a name="resolving">Resolving External Entities</a></h2>
<p>Defining the mapping between external entities to system files
may be done via the <a href="#-catalog"><code>-catalog</code></a>
command-line option. The <em>catalog</em> provides you with the
capability of mapping public identifiers to system identifiers
(files) or to map entity names to system identifiers.
</p>
<!-- @(#) catalog.mod 1.4 96/10/07 @(#)
-->
<p><strong>Catalog Syntax</strong></p>
<p>The syntax of a catalog is a subset of SGML catalogs
(as defined in
<cite>SGML Open Draft Technical Resolution 9401:1994</cite>).
</p>
<p>A catalog contains a sequence of the following types of entries:
</p>
<dl>
<dt><code>PUBLIC</code> <var>public_id</var> <var>system_id</var></dt>
<dd><p>This maps <var>public_id</var> to <var>system_id</var>.
</p>
</dd>
<dt><code>ENTITY</code> <var>name</var> <var>system_id</var></dt>
<dd><p>This maps a general entity whose name is <var>name</var> to
<var>system_id</var>.
</p>
</dd>
<dt><code>ENTITY %</code><var>name</var> <var>system_id</var></dt>
<dd><p>This maps a parameter entity whose name is <var>name</var> to
<var>system_id</var>.
</p>
</dd>
</dl>
<p><strong>Syntax Notes</strong></p>
<ul>
<li><p>A <var>system_id</var> string cannot contain any spaces. The
<var>system_id</var> is treated as pathname of file. </p>
</li>
<li><p>Any line in a catalog file that does not follow the previously
mentioned entries is ignored.</p>
</li>
<li><p>In case of duplicate entries, the first entry defined is used.
</ul>
<p>Example catalog file:</p>
<pre>
-- ISO public identifiers --
PUBLIC "ISO 8879-1986//ENTITIES General Technical//EN" iso-tech.ent
PUBLIC "ISO 8879-1986//ENTITIES Publishing//EN" iso-pub.ent
PUBLIC "ISO 8879-1986//ENTITIES Numeric and Special Graphic//EN" iso-num.ent
PUBLIC "ISO 8879-1986//ENTITIES Greek Letters//EN" iso-grk1.ent
PUBLIC "ISO 8879-1986//ENTITIES Diacritical Marks//EN" iso-dia.ent
PUBLIC "ISO 8879-1986//ENTITIES Added Latin 1//EN" iso-lat1.ent
PUBLIC "ISO 8879-1986//ENTITIES Greek Symbols//EN" iso-grk3.ent
PUBLIC "ISO 8879-1986//ENTITIES Added Latin 2//EN" ISOlat2
PUBLIC "ISO 8879-1986//ENTITIES Added Math Symbols: Ordinary//EN" ISOamso
-- HTML public identifiers and entities --
PUBLIC "-//IETF//DTD HTML//EN" html.dtd
PUBLIC "ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML" ISOlat1.ent
ENTITY "%html-0" html-0.dtd
ENTITY "%html-1" html-1.dtd
</pre>
<p><strong>Environment Variables</strong></p>
<p>The following
envariables (ie. environment variables) are supported:
</p>
<dl>
<dt><a name="P_SGML_PATH">P_SGML_PATH</a></dt>
<dd><p>This is a colon (semi-colon for MSDOS users)
separated list of paths for finding catalog files
or system identifiers. For example, if a system identifier is not
an absolute pathname, then the paths listed in P_SGML_PATH are used to
find the file.
</p>
</dd>
<dt><a name="SGML_CATALOG_FILES">SGML_CATALOG_FILES</a></dt>
<dd><p>This envariable is a colon (semi-colon for MSDOS users)
separated list of catalog files to read.
If
a file in the list is not an absolute path, then file is searched in
the paths listed in the P_SGML_PATH and SGML_SEARCH_PATH.
</p>
</dd>
<dt><a name="SGML_SEARCH_PATH">SGML_SEARCH_PATH</a></dt>
<dd><p>This is a colon (semi-colon for MSDOS users)
separated list of paths for finding catalog files
or system identifiers. This envariable serves the same function as
P_SGML_PATH. If both are defined, paths listed in P_SGML_PATH are
searched first before any paths in SGML_SEARCH_PATH.</p>
</dd>
</dl>
<p>The use of P_SGML_PATH is for compatibility with earlier versions.
SGML_CATALOG_FILES and SGML_SEARCH_PATH
are supported for compatibility with James Clark's <code>nsgmls(1)</code>.
</p>
<dl>
<dt><strong>Note</strong></dt>
<dd>When searching for a file via the P_SGML_PATH and/or SGML_SEARCH_PATH,
if the file is not found in any of the paths, then the current working
directory is searched.
</dd>
</dl>
<dl>
<dt><strong>Note</strong></dt>
<dd><p>
The file specified by
<a href="#-catalog"><code>-catalog</code></a>
is read first before any files specified by SGML_CATALOG_FILES.
</p>
</dd>
</dl>
<!-- =================================================================== -->
<!-- @(#) avail.mod 1.1 96/09/30 @(#)
-->
<hr>
<h2><a name="availability">Availability</a></h2>
<p>This program is part of the <em>perlSGML</em> package; see
<URL:<a href="file:/usr/doc/perlsgml/perlSGML.html"
>file:/usr/doc/perlsgml/perlSGML.html</a>>
</p>
<!-- @(#) author.mod 1.1 96/09/30 @(#)
-->
<hr>
<h2><a name="author">Author</a></h2>
<address>
<a href="http://www.oac.uci.edu/indiv/hood">Earl Hood</a>
<<a href="mailto:ehood@medusa.acs.uci.edu"
>ehood@medusa.acs.uci.edu</a>><br>
</address>
<!-- =================================================================== -->
<hr>
</body>
</html>
|