home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / downloads / 401065 / WPO11 / Data1.cab / _7562AE4C79E04518A0BB8C352FCA3E3D < prev    next >
Text File  |  2003-03-07  |  18KB  |  492 lines

  1. Working with catalog files
  2.  
  3. Catalog files provide a method for locating external information referenced from a DTD or document.
  4.  
  5. In this section, you'll learn about
  6.  
  7.   catalog files
  8.   
  9.   mapping to filenames
  10.   
  11.   mapping to WordPerfect template files
  12.   
  13.   catalog entries not supported by WordPerfect
  14.   
  15.   performing a catalog lookup
  16.   
  17.   how the WordPerfect DTD Compiler uses catalog files
  18.   
  19.   how WordPerfect uses catalog files
  20.   
  21.   external entities and catalog entries
  22.   
  23. What is a catalog file?
  24.  
  25. A catalog file is a text file that links an entity's name or external identifier to a filename on a particular system. When an SGML or XML processor encounters an external entity reference in a DTD or document instance, it must have a way to locate the entity's content. The catalog file provides an application-independent way to map a public or system identifier to the actual file containing an entity's content.
  26.  
  27. The most common catalog file entries map a public or system identifier to a file on your system. WordPerfect uses the proprietary keywords WPT_PUBLIC, WPT_SYSTEM and WPT_ROOT to locate the appropriate WordPerfect template file using the information from a document's DOCTYPE declaration.
  28.  
  29. The format of a catalog file is defined by the Organization for the Advancement of Structured Information Standards (OASIS), an industry consortium formerly known as SGML Open. For more information, see the OASIS Technical Resolution on Entity Management at www.oasis-open.org/html/a401.htm.
  30.  
  31. Mapping to filenames
  32.  
  33. A catalog file consists of one or more catalog entries. You can map public identifiers, entity names, system identifiers and document type names to filenames.
  34.  
  35. To map a public identifier to a filename
  36.  
  37. You can map a public identifier to a filename using the PUBLIC catalog entry. The PUBLIC catalog entry type is the most common of entry types.
  38.  
  39. Example
  40.  
  41. PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN"
  42.  
  43. "isolat1.ent"
  44.  
  45. This catalog entry would match an entity declared and referenced in the catalog file in the following manner:
  46.  
  47. <!ENTITY % ISOlat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN">
  48.  
  49. %ISOlat1
  50.  
  51. Tip
  52.  
  53.   You can also use the PUBLIC catalog entry type to match the public identifier associated with the BASESET, CAPACITY, and SYNTAX portions of an SGML declaration, and with the public identifier (if any) specified in a DOCTYPE declaration.
  54.   
  55. To map an entity name to a filename
  56.  
  57. You can map an entity name to a filename using the ENTITY catalog entry type. The ENTITY catalog entry type is used for entities that are declared in the catalog file as "external" by virtue of the SYSTEM keyword, but for which no explicit system identifier is provided.
  58.  
  59. Example
  60.  
  61. ENTITY "%WPtable"
  62.  
  63. "wptable.dtd"
  64.  
  65. This catalog entry would match an entity declared and referenced in the catalog file in the following manner:
  66.  
  67. <!ENTITY % WPtable SYSTEM>
  68.  
  69. %WPtable
  70.  
  71. The entity name present in the catalog entry begins with the '%' character. In the preceding example, this catalog entry will only match a parameter entity with the name "WPtable". The corresponding catalog entry for a general entity with the same name would omit the leading '%' character:
  72.  
  73. ENTITY "WPtable"
  74.  
  75. "wptable.dtd"
  76.  
  77. To map a system identifier to a filename
  78.  
  79. You can map a system identifier to a filename using the SYSTEM catalog entry. A catalog entry of type SYSTEM may also be used to match the system identifier (if any) specified in a DOCTYPE declaration in the catalog file.
  80.  
  81. Example
  82.  
  83. SYSTEM "mychars.ent"
  84.  
  85. "c:\MyFiles\mychars.ent"
  86.  
  87. This catalog entry would match an entity declared and referenced in the catalog file in the following manner:
  88.  
  89. <!ENTITY % FunChars SYSTEM "mychars.ent">
  90.  
  91. %FunChars
  92.  
  93. Note
  94.  
  95.   A matching SYSTEM catalog entry takes precedence over a matching PUBLIC or ENTITY catalog entry. For example, an external entity is declared and referenced in the catalog file as follows:
  96.   
  97.   <!ENTITY % ISOlat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN" "junk.ent">
  98.   
  99.   %ISOlat1
  100.   
  101.   And, the following catalog entries existed in the catalog file:
  102.   
  103.   PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN"
  104.   
  105.   "isolat1.ent"
  106.   
  107.   ENTITY "%ISOlat1"
  108.   
  109.   "isolat1.txt"
  110.   
  111.   SYSTEM "junk.ent"
  112.   
  113.   "c:\autoexec.bat"
  114.   
  115.   Although all three catalog entries match the information from the entity declaration, the SYSTEM catalog entry has the highest priority. Thus, the application will try to process the "autoexec.bat" file in place of the %ISOlat1; reference.
  116.   
  117. To map the document type name to a filename
  118.  
  119. You can map the document type name found in a document type declaration to a filename using the DOCTYPE catalog entry.
  120.  
  121. Example
  122.  
  123. DOCTYPE "book"
  124.  
  125. "book.dtd"
  126.  
  127. This catalog entry would match the external subset referenced in the catalog file in the following manner:
  128.  
  129. <!DOCTYPE book SYSTEM>
  130.  
  131. Note
  132.  
  133.   The external identifier may also include explicit public and/or system identifiers, in which case the DOCTYPE entry would only be tested after searching for a matching SYSTEM entry and PUBLIC entry.
  134.   
  135. Mapping to WordPerfect template files
  136.  
  137. The OASIS catalog file specification allows for non-standard catalog entry types. WordPerfect makes use of 3 proprietary catalog entry types to streamline the opening of XML and SGML documents. You can map public identifers, system identifiers and document type names to WordPerfect template files.
  138.  
  139. To map the public identifier to a WordPerfect template file
  140.  
  141. You can map the public identifier from a document's DOCTYPE declaration to the filename of a WordPerfect template (WPT) file using the WPT_PUBLIC catalog entry type.
  142.  
  143. Example
  144.  
  145. WPT_PUBLIC "-//Corel//DTD Book Model//EN"
  146.  
  147. "book.wpt"
  148.  
  149. This catalog entry would match the public identifier in the catalog file in situations similar to one of the following:
  150.  
  151. <!DOCTYPE book PUBLIC "-//Corel//DTD Book Model//EN">
  152.  
  153. <book>[...]</book>
  154.  
  155.  
  156.  
  157. <!DOCTYPE book PUBLIC "-//Corel//DTD Book Model//EN" [
  158.  
  159.  [Local markup declarations]
  160.  
  161. ]>
  162.  
  163. <book>[...]</book>
  164.  
  165. Note
  166.  
  167.   This catalog entry type is used when opening an XML or SGML document in the WordPerfect editor, and not when parsing a DTD.
  168.   
  169. To map the system identifier to a WordPerfect template file
  170.  
  171. You can map the system identifier from a document's DOCTYPE declaration to the filename of a WordPerfect template (WPT) file using the WPT_PUBLIC catalog entry type.
  172.  
  173. Example
  174.  
  175. WPT_SYSTEM "book.dtd"
  176.  
  177. "book.wpt"
  178.  
  179. This catalog entry would match the system identifier in the catalog file in situations similar to one of the following:
  180.  
  181. <!DOCTYPE book SYSTEM "book.dtd">
  182.  
  183. <book>[...]</book>
  184.  
  185.  
  186.  
  187. <!DOCTYPE book SYSTEM "book.dtd" [
  188.  
  189.  [Local markup declarations]
  190.  
  191. ]>
  192.  
  193. <book>[...]</book>
  194.  
  195. Note
  196.  
  197.   This catalog entry type is used when opening an XML or SGML document in the WordPerfect editor, and not when parsing a DTD.
  198.   
  199. To map the document type name to a WordPerfect file
  200.  
  201. You can map the document type name (the name of the "root" element) from a document's DOCTYPE declaration to the filename of a WordPerfect template (WPT) file using the WPT_ROOT catalog entry type.
  202.  
  203. Example
  204.  
  205. WPT_ROOT "book"
  206.  
  207. "book.wpt"
  208.  
  209. This catalog entry would match the document type name in the catalog file in situations similar to one of the following:
  210.  
  211. <!DOCTYPE book PUBLIC "-//Corel//DTD Book Model//EN">
  212.  
  213. <book>[...]</book>
  214.  
  215.  
  216.  
  217. <!DOCTYPE book SYSTEM "book.dtd">
  218.  
  219. <book>[...]</book>
  220.  
  221.  
  222.  
  223. <!DOCTYPE book [
  224.  
  225. ...local markup declarations...
  226.  
  227. ]>
  228.  
  229. <book>[...]</book>
  230.  
  231. Note
  232.  
  233.   This catalog entry type is used when opening an XML or SGML document in the WordPerfect editor, and not when parsing a DTD.
  234.   
  235. Catalog entries not supported by WordPerfect
  236.  
  237. The following catalog entry types are not currently used in WordPerfect:
  238.  
  239.   NOTATION
  240.   
  241.   LINKTYPE
  242.   
  243.   SGMLDECL
  244.   
  245.   DTDDECL
  246.   
  247.   DOCUMENT
  248.   
  249.   DELEGATE
  250.   
  251.   CATALOG
  252.   
  253.   OVERRIDE
  254.   
  255.   BASE
  256.   
  257. Although these types are considered valid, and are preserved, they are not otherwise acted upon.
  258.  
  259. For more information on these catalog entry types, see the OASIS Technical Resolution on Entity Management at www.oasis-open.org/html/a401.htm.
  260.  
  261. Performing a catalog lookup
  262.  
  263. When you perform a catalog lookup, the first catalog file in the list of "active" catalogs is searched for a matching catalog entry. If more than one catalog entry type can be considered to match, the same catalog file is searched multiple times before the lookup moves to the next active catalog file. The lookup process stops as soon as a match is found.
  264.  
  265. Example of a catalog lookup
  266.  
  267. The following declaration and reference are encountered in a DTD being processed by the WordPerfect DTD Compiler:
  268.  
  269.     <!ENTITY % test PUBLIC "-//Corel//ENTITIES Entity test set//EN" "testenty.ent">
  270.  
  271.     %test
  272.  
  273. When the parameter entity reference "%test; " is encountered, the WordPerfect DTD Compiler performs a catalog lookup to determine the name of the file containing the replacement text of the "test" entity.
  274.  
  275. Assuming that no match is found in the first active catalog file, the catalog file will be searched three times:
  276.  
  277.   once for a SYSTEM catalog entry with the system identifier "testenty.ent",
  278.   
  279.   once for a PUBLIC catalog entry with the public identifier "-//Corel//ENTITIES Entity test set//EN", and
  280.   
  281.   once for an ENTITY catalog entry with the entity name "%test".
  282.   
  283. Then the catalog lookup proceeds to the subsequent active catalog files (if any) and performs the same three searches in each one until a match is found or the list is exhausted.
  284.  
  285. Note
  286.  
  287.   If a matching ENTITY catalog entry is found in the first catalog file, the lookup will stop without searching any other catalog files. This is true even if a subsequent catalog contains a higher-priority entry that would match the public or system identifier.
  288.   
  289. How the WordPerfect DTD Compiler uses catalog files
  290.  
  291. As installed, the WordPerfect DTD Compiler has only one active catalog file in its list: COMPILE.CAT. The COMPILE.CAT file contains entries matching each of the installed files that can be used while compiling a DTD.
  292.  
  293. A catalog lookup is performed by the WordPerfect DTD Compiler in the following situations:
  294.  
  295.   For each BASESET in the SGML declaration, except the first one. The WordPerfect DTD Compiler assumes the public identifier of the first BASESET to be either:
  296.   
  297. "ISO 646-1983//CHARSET International Reference Version (IRV)//ESC 2/5 4/0", or
  298.  
  299. "ISO 646:1983//CHARSET International Reference Version (IRV)//ESC 2/5 4/0".
  300.  
  301. No catalog lookup is performed for these public identifiers because they represent the default character set used by the WordPerfect DTD Compiler.
  302.  
  303.   For the public identifier (if any) associated with the CAPACITY clause in the SGML declaration, unless the public identifier is either:
  304.   
  305. "ISO 8879-1986//CAPACITY Reference//EN", or
  306.  
  307. "ISO 8879:1986//CAPACITY Reference//EN".
  308.  
  309. No catalog lookup is performed for these public identifiers because they represent the default capacity set used by the DTD Compiler.
  310.  
  311.   For the public identifier (if any) associated with the SYNTAX clause in the SGML declaration, unless the public identifier is one of the following:
  312.   
  313. "ISO 8879-1986//SYNTAX Reference//EN"
  314.  
  315. "ISO 8879:1986//SYNTAX Reference//EN"
  316.  
  317. "ISO 8879-1986//SYNTAX Core//EN"
  318.  
  319. "ISO 8879:1986//SYNTAX Core//EN"
  320.  
  321. No catalog lookup is performed for these public identifiers because they represent the default concrete syntax used by the WordPerfect DTD Compiler.
  322.  
  323.   For the system identifier, public identifier, and/or entity name associated with an external parameter entity. Searches will be done for matching catalog entries of type SYSTEM, then PUBLIC, then ENTITY.
  324.   
  325.   For an external declaration subset. An external declaration subset is assumed to exist when the DOCTYPE declaration specifies a public and/or system identifier, for example:
  326.   
  327. <!DOCTYPE book PUBLIC "-//Corel//DTD Book Model//EN" "book.dtd" [local markup declarations]>, or
  328.  
  329. <!DOCTYPE book PUBLIC "-//Corel//DTD Book Model//EN" [local markup declarations]>, or
  330.  
  331. <!DOCTYPE book SYSTEM "book.dtd" [local markup declarations]>
  332.  
  333. Searches will be done for matching entries of type SYSTEM, then PUBLIC, then DOCTYPE. Catalog entries of type ENTITY are not considered in this situation.
  334.  
  335. If a match is found, the WordPerfect DTD Compiler will attempt to open the file specified in the matching entry. If the filename has a relative path, or no path, the file will be assumed to be relative to the path containing the catalog file. If the file cannot be found or opened, an error is displayed and the compile process halts.
  336.  
  337. If no matching entry is found during the catalog lookup process, the WordPerfect DTD Compiler will attempt to use the system identifier from the entity declaration as a filename. If the system identifier is a full path, it will be used as-is. Since "testenty.ent" has no specified path, the WordPerfect DTD Compiler will determine the location of the file containing the entity reference and try to open a file named "testenty.ent" in the same folder.
  338.  
  339. Note
  340.  
  341.   If the only information available is a public identifier, the catalog lookup will only examine PUBLIC catalog entries.
  342.   
  343. How WordPerfect uses catalog files
  344.  
  345. WordPerfect only performs catalog lookups when opening an XML or SGML file. As installed, WordPerfect has only one active catalog file in its list: IMPORT.CAT. The IMPORT.CAT file contains entries matching each of the installed XML/SGML documents that can be opened in WordPerfect.
  346.  
  347. WordPerfect performs a catalog lookup to determine which WordPerfect template file should be used for the XML/SGML document instance being opened. For example, suppose the file being opened begins like this:
  348.  
  349. <!DOCTYPE book PUBLIC "-//Corel//DTD Book Model//EN" "book.dtd" [local markup declarations]>
  350.  
  351. <book>[...]</book>
  352.  
  353. In this case, the catalog lookup will perform searches for matching entries of type WPT_PUBLIC, then WPT_SYSTEM, then WPT_ROOT. The public identifier is given a higher priority than the system identifier. This is because the system identifier in this situation should identify a file containing an actual DTD markup declaration subset. Since WordPerfect is using the document type information to find a WordPerfect template file, and not an actual DTD subset, the public identifier is given priority as a more indirect reference to the DTD subset.
  354.  
  355. If no DOCTYPE declaration appears at the beginning of the XML/SGML document instance, an attempt is made to locate the first start tag in the document. If one is found, a catalog lookup will be performed to search for a matching WPT_ROOT entry.
  356.  
  357. If a match is found, WordPerfect will attempt to use the file specified in the matching entry as the base template for the imported document instance. If the filename includes a full path, it will be used as-is. If the filename has a relative path, or no path, the file will be assumed to be relative to XML template folder.
  358.  
  359. If no matching entry is found during the catalog lookup process, WordPerfect will not attempt to use the system identifier from the entity declaration as a filename. This is because the system identifier refers to a file containing part of an actual DTD, and not to a WordPerfect template.
  360.  
  361. External entities and catalog entries
  362.  
  363. The following external entities and catalog entries that could be used to locate matching files on a system:
  364.  
  365.   entity declaration with PUBLIC identifier
  366.   
  367.   entity declaration with SYSTEM identifier
  368.   
  369.   entity declaration with both PUBLIC and SYSTEM identifiers
  370.   
  371.   entity declaration with SYSTEM keyword but no SYSTEM identifier
  372.   
  373.   BASESET section in the SGML declaration
  374.   
  375.   CAPACITY section in the SGML declaration
  376.   
  377.   DOCTYPE statement with a PUBLIC identifier
  378.   
  379.   DOCTYPE statement with a SYSTEM identifier
  380.   
  381.   DOCTYPE statement with neither a PUBLIC nor a SYSTEM identifier
  382.   
  383.   no DOCTYPE statement, but first start tag represents the root element
  384.   
  385. Entity Declaration with PUBLIC identifier
  386.  
  387. <!ENTITY % ISOlat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN">
  388.  
  389. Catalog Entry
  390.  
  391. PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN"
  392.  
  393. "ISOlat1.ent"
  394.  
  395. Entity Declaration with SYSTEM identifier
  396.  
  397. <!ENTITY graph1 SYSTEM "windmill.bmp">
  398.  
  399. Catalog Entry
  400.  
  401. SYSTEM "windmill.bmp"
  402.  
  403. "c:\myfiles\graphics\windmill.bmp"
  404.  
  405. Entity Declaration with both PUBLIC and SYSTEM identifiers
  406.  
  407. <!ENTITY % wpchars PUBLIC "-//Corel//ENTITIES WP 6.1 Characters (Non-ISO 8879)//EN" "wpchars.ent">
  408.  
  409. Catalog Entries
  410.  
  411. PUBLIC "-//Corel//ENTITIES WP 6.1 Characters (Non-ISO 8879)//EN"
  412.  
  413. "c:\corel\suite9\xml\dtd\mapfiles\wpchars.ent"
  414.  
  415. SYSTEM "wpchars.ent"
  416.  
  417. "c:\corel\suite9\xml\dtd\mapfiles\wpchars.ent"
  418.  
  419. Entity Declaration with SYSTEM keyword but no SYSTEM identifier
  420.  
  421. <!ENTITY module SYSTEM>
  422.  
  423. Catalog Entry
  424.  
  425. ENTITY "module"
  426.  
  427. "c:\windmill.bmp"
  428.  
  429. BASESET section in the SGML Declaration
  430.  
  431. BASESET "Upper half of IBM code page 437 (US, English)"
  432.  
  433. Catalog Entry
  434.  
  435. PUBLIC "Upper half of IBM code page 437 (US, English)"
  436.  
  437. "Cp437.set"
  438.  
  439. CAPACITY section in the SGML Declaration
  440.  
  441. CAPACITY PUBLIC "ISO 8879:1986//CAPACITY WordPerfect 11//EN"
  442.  
  443. Catalog Entry
  444.  
  445. PUBLIC "ISO 8879:1986//CAPACITY WordPerfect 11//EN"
  446.  
  447. "WP9.cap"
  448.  
  449. DOCTYPE statement with a PUBLIC identifier
  450.  
  451. <!DOCTYPE book PUBLIC "-//Corel//DTD Book declarations//EN">
  452.  
  453. Catalog Entry
  454.  
  455. WPT_PUBLIC "-//Corel//DTD Book declarations//EN"
  456.  
  457. "book.wpt"
  458.  
  459. DOCTYPE statement with a SYSTEM identifier
  460.  
  461. <!DOCTYPE book SYSTEM "Corel Book DTD">
  462.  
  463. Catalog Entry
  464.  
  465. WPT_SYSTEM "Corel Book DTD"
  466.  
  467. "book.wpt"
  468.  
  469. DOCTYPE statement with neither a PUBLIC nor a SYSTEM identifier
  470.  
  471. <!DOCTYPE book [ (local declarations) ]>
  472.  
  473. Catalog Entry
  474.  
  475. WPT_ROOT "book"
  476.  
  477. "book.wpt"
  478.  
  479. No DOCTYPE statement, but first start tag represents the root element
  480.  
  481. <book><titlepage><author>...
  482.  
  483. Catalog Entry
  484.  
  485. WPT_ROOT "book"
  486.  
  487. "book.wpt"
  488.  
  489.  
  490.  
  491.  
  492.