Associating DTD public identifier with local DTD file

Post here questions and problems related to oXygen frameworks/document types.
mboudreau
Posts: 20

Associating DTD public identifier with local DTD file

Mon Aug 14, 2017 11:03 pm

I'm trying to do something that I think is fairly simple, but I confess I'm confused by some of the vocabulary used in the online documentation.

I'm working with a bunch of files that reference a DTD by its public identifier. E.g.,

Code: Select all

<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "journalpublishing3.dtd">


I have a local copy of this DTD on my machine at:

Code: Select all

/Users/mrb/Documents/DTDs/journalpublishing-3.0/journalpublishing3.dtd


How do I tell Oxygen to use the local file when it encounters the doctype above?
Radu
Posts: 5088

Re: Associating DTD public identifier with local DTD file

Tue Aug 15, 2017 9:07 am

Hi,

Usually this is done using the XML catalog support in Oxygen:

https://www.oxygenxml.com/doc/versions/19.0/ug-editor/topics/using-XML-Catalogs.html

You can create an XML catalog file named for example "catalog.xml" with the content:

Code: Select all

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <public publicId="-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" uri="../relative/path/to/journalpublishing3.dtd"/>
</catalog>


and then in the Oxygen Preferences->XML / XML Catalog page add a new reference to your XML catalog, then reopen the XML and validate it.

Usually most sets of DTDs already come with xml catalogs so you may just need to add a reference to the XML catalog located next to your DTDs.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 20

Re: Associating DTD public identifier with local DTD file

Sat Aug 19, 2017 12:47 am

Thanks, Radu.
mboudreau
Posts: 20

Re: Associating DTD public identifier with local DTD file

Tue Aug 22, 2017 12:00 am

So I created a catalog file for just one DTD and added it to the XML Catalog preferences, and everything worked fine.

However, I need to work with two DTDs (input and output), and I'm having problems. I created a catalog file for each DTD, and put the catalog files into the directories containing the DTD files. Now I get validation errors when I'm parsing an instance of the DTD whose catalog file comes second in the XML Catalog preferences list. (For each DTD, I can validate an instance with no errors if that DTD's catalog file is the only one in the preferences list.)

My two DTDs are slightly customized versions of NLM Journal Publishing 3.0 (input) and JATS 1.0.4 (output), which are fairly similar. One important difference is that, while we use the CALS table markup in each (instead of XHTML), we use the 'oasis' namespace prefix only in the JATS 1.0.4 (output) files, and this seems to be at the root of the problem.

How do I ensure that for each DTD, Oxygen consults only the DTD files in the same directory as the main DTD file?
Radu
Posts: 5088

Re: Associating DTD public identifier with local DTD file

Tue Aug 22, 2017 8:06 am

Hi,

From the entire list of specified XML catalogs Oxygen creates a single pool of mappings and after this it will use the XML catalog mappings in the order in which they have been specified to resolve references.
So (at least with the current and previous Oxygen versions) you cannot specify that for a certain validated XML document, only a certain set of XML catalogs should be taken into account.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
mboudreau
Posts: 20

Re: Associating DTD public identifier with local DTD file

Tue Aug 22, 2017 7:07 pm

I have a solution, but I'm not sure if it's ideal.

I set up frameworks for both document types, using only the Public ID for each one in the association rules, specifying the DTD, and adding a catalog file for each one. Tested again, but I was still getting validation errors.

So I compared all the public identifiers in the two DTDs, found the one (related to OASIS tables) that was common to both, and changed it in the .ent file that invoked it and in the catalog file. Now I can have articles in each doctype open simultaneously, and they both validate without errors.

As long as I document this in some README files in various locations, I think I can live with it. But if there's a better solution I'd be grateful for advice.
Radu
Posts: 5088

Re: Associating DTD public identifier with local DTD file

Wed Aug 23, 2017 7:57 am

Hi,

I think you have found the perfect solution for now. You could have also disabled one of the two frameworks if you usually work for long periods of times with only one type of XML. But if you use both types of XML all the time, indeed you need to modify one of the XML catalog mappings and also modify the DTDs from one framework to use a particular mapping in order to stop resolving its reference to a module via another XML catalog.
This is not the first report that the CALS table DTD modules from the JATS framework interfere with other frameworks.
Usually if two catalogs resolve a public ID they should resolve it to the same version of the DTD, so that it would not matter what catalog resolved it first.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 0 guests