Menu

DTD storage

Help
Alexey
2009-05-02
2012-12-07
  • Alexey

    Alexey - 2009-05-02

    Hi,

    I want to validate XML documents against a custom DTD file; http://www.pardus.org.tr/projeler/pisi/pisi-spec.dtd

    Here's a quote from XML Copy Editor Help:

    Validation
    ...
    To validate against a DTD or XML Schema, the document needs to be attached to the relevant definition or schema.
    DTDs are stored locally. A number of DTDs are installed by default (e.g. the public identifier ‘-//W3C/DTD XHTML 1.0 Strict//EN’ is keyed to a local copy of the XHTML 1.0 Strict DTD), but you can also add new DTDs by editing the file ‘catalog’ in the ‘catalog’ directory and saving copies of the DTDs themselves in the ‘dtd’ directory.
    ...

    It doesn't look like I've got anything like 'catalog' and 'dtd' directories:

    $ ls /usr/share/xmlcopyeditor/
    copying  help  png  po  rng  rulesets  templates  xpm

    What am I suposed to do? I don't know much about dtd/xml handling, so a detailed explanation is welcome :) .

    I use this package: http://aur.archlinux.org/packages.php?ID=6283

     
  • Kurt Keyser

    Kurt Keyser - 2010-05-12

    I have this same question.  Any solution? Where should I put my catalog and DTDs?

     
  • gnschmidt

    gnschmidt - 2010-05-12

    On Linux the system catalog is used. Different distros may use different locations, but the etc folder is usually a good place to start.

    You could also fetch the distro's docbook distribution (for example) and check where the catalog and DTDs are stored.

    If your DTD is installed in the system catalog, xmlce will see it.

    Please note that this applies only to Linux. On Windows, the program creates a separate catalog and DTD collection as there is no standard location to fall back to.

    If this doesn't help, please give me a shout.

    -gerald

     
  • amreg

    amreg - 2010-07-18

    Hi,

    Sorry I'm a newbie to XML, but, what is the "system catalog" for Linux releases ?

    I have both an /etc/xml/catalog and an /etc/sgml/catalog file (and also a dozen of /usr/share/sgml/docbook/sgml-dtd-*/catalog, where * stands for a dozen of different release numbers, not to mention a bunch of other "catalog" files in various directiories such as /usr/share/apps/ksgml/…).

    I guess the first one (the one in /etc/xml) is the right one, but it seems rather obsfuscating :

    <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
      <delegatePublic publicIdStartString="-//OASIS//ENTITIES DocBook XML" catalog="file:///usr/share/sgml/docbook/xmlcatalog"/>
      <delegatePublic publicIdStartString="-//OASIS//DTD DocBook XML" catalog="file:///usr/share/sgml/docbook/xmlcatalog"/>
      <delegatePublic publicIdStartString="ISO 8879:1986" catalog="file:///usr/share/sgml/docbook/xmlcatalog"/>
      <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/" catalog="file:///usr/share/sgml/docbook/xmlcatalog"/>
      <delegateURI uriStartString="http://www.oasis-open.org/docbook/" catalog="file:///usr/share/sgml/docbook/xmlcatalog"/>
      <rewriteSystem systemIdStartString="http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd" rewritePrefix="/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd"/>
      <rewriteURI uriStartString="http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd" rewritePrefix="/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd"/>
      <rewriteSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl/1.73.2" rewritePrefix="file:///usr/share/sgml/docbook/xsl-stylesheets-1.73.2"/>
      <rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/1.73.2" rewritePrefix="file:///usr/share/sgml/docbook/xsl-stylesheets-1.73.2"/>
      <rewriteSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl/current" rewritePrefix="file:///usr/share/sgml/docbook/xsl-stylesheets-1.73.2"/>
      <rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current" rewritePrefix="file:///usr/share/sgml/docbook/xsl-stylesheets-1.73.2"/>
    </catalog>
    

    How could I add a DTD file, to have it appear in the "XML/Validate" list ?
    Could you help ? Thanks.

     
  • gnschmidt

    gnschmidt - 2010-07-19

    The best strategy is to trust your package management.

    On Ubuntu, for example, it should be possible to type:

    sudo apt-get install docbook-xml
    

    at the command prompt.

    The syntax of catalog files is specified in detail at http://www.oasis-open.org/committees/entity/spec-2001-08-06.html.

    Please let me know if this doesn't work.

    Best,
    Gerald

     
  • Kurt Keyser

    Kurt Keyser - 2010-07-30

    Thanks for the initial tip - it got me pointed in the right direction.  I think I'm getting closer to solving this conundrum.  I must say that it is FAR more elegant than the solution in Windows, although somewhat more difficult to have working and dev DTD sets in place at the same time.

    I work at VMware doing DITA-based documentation XML customizations/specializations to our DTDs and modifying them easily on Linux using your tool instead of something like Oxygen would be ideal for me.

    There doesn't appear to be a default DITA XML Ubuntu package I can install as there is with "docbook-xml". So, here's what I have done so far:

    I modified the "/etc/xml/catalog" to add lines for each publicID we use such as:

    <delegatePublic publicIdStartString="-//OASIS//DTD DITA Map//EN" catalog="file:///etc/xml/dita-xml.xml"/>
    

    I then created "/etc/xml/dita-xml.xml" with an entry for each publicID and a reference to our main DITA catalog:

    <?xml version="1.0"?>
    <!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.0//EN"
      "file:///usr/share/xml/schema/xml-core/catalog.dtd">
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
            <delegatePublic publicIdStartString="-//OASIS//DTD DITA Map//EN" catalog="file:///usr/share/xml/dita/catalog-dita.xml"/>
            <delegatePublic publicIdStartString="-//OASIS//DTD DITA 1.1 Map//EN" catalog="file:///usr/share/xml/dita/catalog-dita.xml"/>
            <delegatePublic publicIdStartString="-//OASIS//ELEMENTS DITA Map//EN" catalog="file:///usr/share/xml/dita/catalog-dita.xml"/>
    </catalog>
    

    I then copied our catalog along with the DTDs to the /usr/share/xml/dita/catalog-dita.xml directory.  I had to add the DOCTYPE declaration to the catalog-dita.xml file we use to make sure it validated correctly.

    Now, when I create a DITA Map file and try to validate it, I get the error message

    Unexpected validation error
    

    From what I can tell, I've set it up as close as possible to match the integration of docbook-xml.  At least it now seems to be trying to jump through the various catalogs to find the DTDs instead of looking at our placeholder URN and stopping. I just can't get it to go any farther.  Any ideas?

     

Log in to post a comment.