Project-local catalog

Oxygen general issues.
jkh
Posts: 7
Joined: Tue Oct 21, 2008 9:53 am

Project-local catalog

Post by jkh »

Hi,

I can't find a way to specify a catalog to be attached to and only be used with a specific project. Do I miss something or is it not possible to do this?

The rationale is, that I have a few official XSDs inside my project that contain defect <xs:import/> statements but that I would prefer not to modify locally. Therefore, I want to fix them by using a catalog that is only used inside the project and that should be attached to the project's .xpr. That way, I can commit the fix to the VCS and everyone will get it on checkout automagically.

Regards,
Janko Heilgeist
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Project-local catalog

Post by sorin_ristache »

Hello,

If your XML documents match one of the document types from Preferences -> Document Type Association you should add your XML catalog to the list of XML catalogs of that document type and store the document type associations at project level by selecting the Project Options radio button in the panel Document Type Association of the Preferences dialog.

If your XML documents do not match the document types from Preferences you have to add your XML catalog to the global list of XML catalogs and store that list in the current project by selecting the Project Options radio button.


Regards,
Sorin
jkh
Posts: 7
Joined: Tue Oct 21, 2008 9:53 am

Re: Project-local catalog

Post by jkh »

Hi Sorin,

thanks for your fast response. If I use the "Project Options" to store the catalog in the project file, then the absolute path to the catalog is stored and not the relative path (i.e. the catalog is in a sub-directory of the project). That way, the project file is only valid on my own computer and I can't commit the new project file to the VCS repository.

Regards,
Janko
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Project-local catalog

Post by sorin_ristache »

jkh wrote:the project file is only valid on my own computer and I can't commit the new project file to the VCS repository.
I think the opposite is true. The XML catalog is stored in the Oxygen project file with a relative path. You commit to CVS both the project file and the XML catalog file. Other users will check out from CVS both the project file and the XML catalog file in any location on their computers and the XML catalog will just work. This is the advantage of the relative path stored in the project file. Did you try it and it did not work for you?


Regards,
Sorin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Project-local catalog

Post by sorin_ristache »

I am sorry, is the XML catalog file stored as an absolute path in the project file? That means the path to the XML catalog file cannot be expressed as a relative path because the path of the project file and the path of the XML catalog file do not have a common ancestor directory. You should save the XML catalog file in a directory that can be expressed as a file path relative to the project file.

What is the path of your .xpr project file and what is the path of your XML catalog file?


Regards,
Sorin
jkh
Posts: 7
Joined: Tue Oct 21, 2008 9:53 am

Re: Project-local catalog

Post by jkh »

Yes, the path to the XML catalog is stored as an absolute path inside the project file.

Path of project file:
/home/jheilgei/.../project/project.xpr

Path of catalog:
/home/jheilgei/.../project/src/main/resources/catalog.cat

Content of project.xpr:
<entry>
<String xml:space="preserve">catalogs.v5</String>
<String-array>
<String xml:space="preserve">file:/home/jheilgei/opt/oxygen/frameworks/catalog.xml</String>
<String xml:space="preserve">file:/home/jheilgei/.../project/src/main/resources/catalog.cat</String>
</String-array>
</entry>

I used "..." to strip away three levels for brevity.

Anyway, the path to the catalog can be expressed as the relative path "src/main/resources/catalog.cat". The paths of the schema files (which also reside inside this directory) are correctly expressed as relative paths.

Regards,
Janko
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Project-local catalog

Post by sorin_ristache »

jkh wrote:Yes, the path to the XML catalog is stored as an absolute path inside the project file.

...

Anyway, the path to the catalog can be expressed as the relative path "src/main/resources/catalog.cat".
We will fix that in a future version. The path of the catalog file saved in the project file should be relative.

You can use an editor variable like ${pdu}, ${home} or ${oxygenHome} when you add the path of the XML catalog file to the list of XML catalogs in Preferences. The dialog Choose Catalog has a button for inserting an editor variable in the file path. For example in your case the project file is stored in /home/jheilgei/.../project/ so you should add the catalog file with the path ${pdu}/src/main/resources/catalog.cat where ${pdu} is the project directory as a URL.


Regards,
Sorin
jkh
Posts: 7
Joined: Tue Oct 21, 2008 9:53 am

Re: Project-local catalog

Post by jkh »

Thanks a lot, Sorin. Now it works perfectly!

If you'll fix the relative-path-issue in a future version, maybe you can also change the default-catalog to be stored as "${oxygenHome}/frameworks/catalog.xml" instead of using an absolute path!? This would improve the portability of the project-file even further.

Regards,
Janko
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Project-local catalog

Post by sorin_ristache »

In fact it should be "${frameworks}/catalog.xml". Thank you for pointing it out.


Regards,
Sorin
Post Reply