Loading ...
Sorry, an error occurred while loading the content.

Re: [xml-dbms] reference to DTDs of map and action in v2

Expand Messages
  • Ronald Bourret
    1) I did a bit of research on the Apache Web site, since I ve wondered about this, too. According to:
    Message 1 of 2 , May 3, 2004
    • 0 Attachment
      1) I did a bit of research on the Apache Web site, since I've wondered
      about this, too. According to:

      http://nagoya.apache.org/eyebrowse/ReadMsg?listId=85&msgNo=3327

      the problem is that, when you pass an InputSource built on a Stream to
      Xerces (which is what Transfer does), Xerces does not know what the base
      URI of the InputSource is. Therefore, it cannot resolve relative URIs
      correctly and defaults to using the current directory. The solution to
      this is to call setSystemId on the InputSource before passing it to
      Xerces.

      I tried the following code and it works:

      // Get a FileReader over the XML file and construct an
      // InputSource over that file.

      File f = new File(filename);
      FileReader fr = new FileReader(f);
      InputSource is = new InputSource(fr);

      // Get the base URL of the file and set it as the system ID
      // of the InputSource.
      //
      // This code is technically incorrect on Windows systems.
      // The problem is that path contains ":" and "\" characters,
      // which need to be replaced with "|" and "/", respectively.
      // However, Xerces does interpret the URL correctly.

      String path = f.getAbsolutePath();
      String systemID = "file://localhost/" + path;
      is.setSystemId(systemID);

      // Parse the document. (Or pass the InputSource to the map
      // compiler, etc.)

      xmlReader.parse(is);

      If you are calling DOMToDBMS directly, you can just modify your code
      that passes InputSources to MapCompiler, ActionCompiler, and/or
      FilterCompiler. If you are using Transfer, you will need to modify the
      code in the createMap, createActions, and createFilterSet methods.

      2) If this code doesn't work for some reason, then the DTDs (without
      comments) are available at:

      http://www.rpbourret.com/xmldbms/dtds/xmldbms2alpha3.dtd
      http://www.rpbourret.com/xmldbms/dtds/filtersalpha3.dtd
      http://www.rpbourret.com/xmldbms/dtds/actionsalpha3.dtd

      However, you don't really want to use them. The problem is that your
      users will hit the Web every time they compile a map, filter, or action
      file. VERY slow.

      -- Ron

      holger.schimanski@... wrote:
      >
      > In the map and action-files I have to specify a DTD.
      > Could you place the 2.0 alpha 3-DTDs at
      > http://www.rpbourret.com/xmldbms/xmldbms20alpha3.dtd and
      > http://www.rpbourret.com/xmldbms/xmldbms20alpha3.dtd?
      >
      > Working with local relative path does not work for me, because (on Sun with jdk
      > 1.3 and xerxesImpl.jar)
      > <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd">
      > is translated to ~/xmldbms2.dtd (which is not user-independend) and not relative
      > from the place of the map-file (in the same directory as the map-file).
      >
      > Or is the some other possibility to reference the DTD?
    Your message has been successfully submitted and would be delivered to recipients shortly.