Catalog rewriteSystem not working for UNIX paths

heba2
Posts: 2
Joined: Wed Feb 19, 2020 11:36 am

Catalog rewriteSystem not working for UNIX paths

Post by heba2 » Wed Feb 19, 2020 11:57 am

Hi all,

I have an entity declaration file which referes a UNIX file (because the generator runs on Linux subsystem). For example:

Code: Select all

<!ENTITY % mydoc SYSTEM "/mnt/c/Projects/Doc/fragments/Common/mydoc.ent"> %mydoc;
To help Oxygen find this file I have an XML catalog using rewriteSystem but whatever I declare there is not recognized by Oxygen.

Code: Select all

<rewriteSystem systemIdStartString="/mnt/c/Projects/Doc/" rewritePrefix="file:///C:/Projects/Doc/"/>
Doesn't help if I omit file:// or also add it somewhere else.

Interestingly, if the path to the entity file is Windows-like, it works. In this example, Doc_Path is a variable containing a Windows path and it is correctly replaced and found by Oxygen:

Code: Select all

<rewriteSystem systemIdStartString="file://Doc_Path" rewritePrefix="file:///C:/Projects//Doc/"/>
Any idea what I'm doing wrong?

Heiko

Radu
Posts: 7208
Joined: Fri Jul 09, 2004 5:18 pm

Re: Catalog rewriteSystem not working for UNIX paths

Post by Radu » Wed Feb 19, 2020 1:11 pm

Hi Heiko,

The path ""/mnt/c/Projects/Doc/fragments/Common/mydoc.ent"" is a file path. The code which calls the catalog resolvers first tries to convert it to an URL-like path and on Windows the converted path will look like this:

file:/D:/mnt/c/Projects/Doc/fragments/Common/mydoc.ent

depending on the drive where the Oxygen application is installed.
So your XML catalog will need to use something like file:/D:/mnt/c/Projects/Doc/ in the "systemIdStartString" value.
Or you can use multiple "systemIdSuffix" mappings.
Or instead of using in the XML document a local system ID value you could use an URL-like path:

Code: Select all

<!ENTITY % mydoc SYSTEM "http://sample.com/Projects/Doc/fragments/Common/mydoc.ent"> %mydoc;
which would need to be resolved through the XML catalogs (but the resolution would be consistent on all platforms).

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

heba2
Posts: 2
Joined: Wed Feb 19, 2020 11:36 am

Re: Catalog rewriteSystem not working for UNIX paths

Post by heba2 » Fri Feb 21, 2020 6:28 pm

Thank you, Radu! I tried your solution but I still get FileNotFound exceptions.

It appears that these are now related to nested inclusions. The file "/mnt/c/Projects/Doc/fragments/Common/mydoc.ent" again contains declarations like <!ENTITY % keys SYSTEM "/mnt/c/Projects/Doc/fragments/Common/keys.ent"> %keys;.

Should the rewrite also work for such hierarchical inclusions?

Radu
Posts: 7208
Joined: Fri Jul 09, 2004 5:18 pm

Re: Catalog rewriteSystem not working for UNIX paths

Post by Radu » Mon Feb 24, 2020 9:59 am

Hi,

I proposed to you multiple solutions and I do not know which one you tried.
If you used the "systemIdSuffix" solution then indeed you would need to map all suffixes, included the ones for modules.

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

Post Reply