Deactivate online validation schemas

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Deactivate online validation schemas

Post by Frank Ralf »

Hi,

When using Oxygen 21.1 for the first time I got asked whether Oxygen can fetch validation schemas from remote URLs. I have agreed to trust all sources but now want to change this because I'm using Oxygen in a restricted environment with no internet access. How can I do this?

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Deactivate online validation schemas

Post by Radu »

Hi Frank,

You can look in the Preferences->"Network Connection Settings / Trusted Hosts" page and remove from there the trusted hosts.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Deactivate online validation schemas

Post by Frank Ralf »

Hi Radu,

Many thanks for the pointer!

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Prevent FOP from validating SVG files

Post by Frank Ralf »

Hi Radu,

I found out that the culprit isn't Oxygen but the FOP processor that tries to validate each SVG file against an online DTD.

Code: Select all

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
I've found a post from Ixiasoft with a suggested solution. However, I haven't found out yet which XML catalog file to modify in our custom Oxygen framework or PDF plugin. Actually, I'm not even sure whether Apache FOP uses any of the XML catalog files from either Oxygen or the DITA-OT to resolve the SVG URN.

I suppose this is related to the following known issue:
external-graphic_src_uri.xml (Test case with HTTP URL):
Doesn't work behind a proxy which requires authorization.
Any pointer welcome.

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Deactivate online validation schemas

Post by Radu »

Hi Frank,

So you are using Apache FOP inside a DITA OT plugin to produce the PDF, right?
The <fop> task is defined in this build file:
DITA-OT/plugins/org.dita.pdf2.fop/build_fop.xml

Code: Select all

<fop format="${fop.formatter.output-format}" fofile="${pdf2.temp.dir}/topic.fo" basedir="${pdf2.temp.dir}"
         outfile="${outputFile}" messagelevel="info" relativebase="true" force="true"
         userconfig="${args.fo.userconfig}"/>
Looking at the parameter you can send to the FOP task:

https://xmlgraphics.apache.org/fop/2.4/anttask.html

there seems to be no parameter for XML catalog.

There are two things you could do:

1) Avoid having SVG documents with a DOCTYPE declaration inside them.
2) Replace in the build file the "<fop>" ANT task with a call to the FOP command line which does have an xml catalog parameter:
https://xmlgraphics.apache.org/fop/2.4/running.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Deactivate online validation schemas

Post by Frank Ralf »

Hi Radu,

Many thanks for your answer! That definitely spared me a wild goose chase ;-)

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Deactivate online validation schemas

Post by chrispitude »

Hi Radu,

Is this SVG schema-checking issue resolved in PDF Chemistry?

I've removed DOCTYPE from our existing SVG files, but writers will create new ones over time.
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Deactivate online validation schemas: Batik Pretty Printer

Post by Frank Ralf »

Hi,

I've seen that Apache Batik, the library for processing SVGs, comes with a Pretty Printer tool that could probably be used to modify or remove the doctype declaration of SVGs:
-doctype change | remove : Specifies whether the doctype should be changed or removed,
-publid-id string : Specifies the public ID to in the doctype declaration, when -doctype change is specified, and
-system-id string : Specifies the system ID to in the doctype declaration, when -doctype change is specified.
Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
julien_lacour
Posts: 481
Joined: Wed Oct 16, 2019 3:47 pm

Re: Deactivate online validation schemas

Post by julien_lacour »

Hello,

The problem is normally fixed in Oxygen 22.0, you can try on your side and see if the problem still occurs.

Regards,
Julien
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Deactivate online validation schemas

Post by Radu »

Hi,

Julien's remark above is for the PDF publishing using CSS. The problem with the XSL-FO based publishing still remains.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Prevent FOP from validating SVGs

Post by Frank Ralf »

Hi Radu,

We have only now come to try your suggestion by modifying org.dita.pdf2.fop\build_fop.xml as follows:

Code: Select all

<target name="transform.fo2pdf.fop" if="use.fop.pdf.formatter">
<!--    <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"/>-->
    
    <condition property="outputFile" value="${dita.output.dir}/${outputFile.base}${xsl.formatter.ext}">
      <not><isset property="outputFile"/></not>
    </condition>
    <mkdir dir="${dita.output.dir}"/>
    
<!--    <fop format="${fop.formatter.output-format}" fofile="${pdf2.temp.dir}/topic.fo" basedir="${pdf2.temp.dir}"
         outfile="${outputFile}" messagelevel="info" relativebase="true" force="true"
         userconfig="${args.fo.userconfig}"/>
-->
    <exec dir="V:\fop-2.3\fop" executable="V:\fop-2.3\fop\fop.bat">
      <arg line="-fo ${pdf2.temp.dir}/topic.fo -pdf ${outputFile} -catalog -c ${args.fo.userconfig}"/>
    </exec>

    <dita-ot-fail id="PDFX013F">
      <condition>
        <and>
          <equals arg1="${fop.failOnError}" arg2="true"/>
          <not>
            <available file="${outputFile}" type="file"/>
          </not>
        </and>
      </condition>
      <param name="1" value="${outputFile}"/>
    </dita-ot-fail>
  </target>
  
This indeed solved the problem of the SVG validation and sped PDF generation up tenfold.

However, some issues remain.
  1. We had to use a separate FOP (V:\fop-2.3\fop\fop.bat) because the FOP bundeled with the org.dita.pdf2.fop plugin doesn't come with the required batch script/shell script.
  2. We have not yet testet to run the jar file directly.
  3. Strangely, it doesn't seem to matter whether we set the -catalog parameter at all, because calling FOP from the command line seems to be enough to prevent the SVG validation. This would point to a general difference between the <fop> task and the <exec> task.
So now we are a little stuck on how best to proceed. Any pointers welcome.

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

FOP SVG validation: Jira bug

Post by Frank Ralf »

Finally found the related bug in the FOP Jira. Dates from 2012, last updated 2016. Still open and unresolved.

FOP should provide SVG DTD
Frank Ralf
parson AG
www.parson-europe.com
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Deactivate online validation schemas

Post by Radu »

Hi Frank,

Sorry but I don't know why this difference between the FOP command line and using directly the FOP ANT task exists.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Frank Ralf
Posts: 450
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Deactivate online validation schemas

Post by Frank Ralf »

Hi Radu,

Thanks for your reply. We keep investigating ;-)

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Post Reply