RE: Namespaces are dropped in XMP stream. XML invalid

Jörn Willhöft <[email protected]> Thu, 7 Nov 2024 16:48:55 +0100 (CET)
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
------=_Part_36027_1807406458.1730994535695
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Well the bug is in Apache FOP (or maybe in Saxon?) Here is a reproducible t=
est procedure:
=20
I use the FOP binary package from https://www.apache.org/dyn/closer.cgi?fil=
ename=3D/xmlgraphics/fop/binaries/fop-2.10-bin.tar.gz&action=3Ddownload and=
 the current Saxon 12.5 HE.
=20
Create PDF without Saxon:
   $ fop-2.10/fop/fop -c PDFA3Xmp.xconf -fo PDFXMP.fo -pdf output-ok.pdf
=20
Create PDF with Saxon:
  $ export CLASSPATH=3DSaxonHE12-5J/saxon-he-12.5.jar:SaxonHE12-5J/lib/xmlr=
esolver-5.2.2.jar:SaxonHE12-5J/lib/xmlresolver-5.2.2-data.jar:SaxonHE12-5J/=
lib/jline-2.14.6.jar
  $ fop-2.10/fop/fop -c PDFA3Xmp.xconf -fo PDFXMP.fo -pdf output-saxon.pdf
=20
Result without Saxon:
  $ pdfinfo -meta output-ok.pdf
...
       <rdf:Description xmlns:pdfaExtension=3D"http://www.aiim.org/pdfa/ns/=
extension/" rdf:about=3D"">
           <pdfaExtension:schemas>
               <rdf:Bag>
                   <rdf:li rdf:parseType=3D"Resource">
                       <pdfaSchema:property xmlns:pdfaSchema=3D"http://www.=
aiim.org/pdfa/ns/schema#">
                           <rdf:Seq>
                               <rdf:li rdf:parseType=3D"Resource">
                                   <pdfaProperty:name xmlns:pdfaProperty=3D=
"http://www.aiim.org/pdfa/ns/property#">split</pdfaProperty:name>
                               </rdf:li>
                           </rdf:Seq>
                       </pdfaSchema:property>
                   </rdf:li>
               </rdf:Bag>
           </pdfaExtension:schemas>
       </rdf:Description>
...
=20
The result with Saxon is totally messed up:
$ pdfinfo -meta output-saxon.pdf
...
     <rdf:RDF xmlns:pdfaExtension=3D"http://www.aiim.org/pdfa/ns/extension/=
" rdf:about=3D"">
        <pdfaExtension:schemas>
           <rdf:Bag>
              <rdf:li rdf:parseType=3D"Resource">
                 <pdfaSchema:property>
                    <rdf:Seq>
                       <rdf:li rdf:parseType=3D"Resource">
                          <pdfaProperty:name>split</pdfaProperty:name>
                       </rdf:li>
                    </rdf:Seq>
                 </pdfaSchema:property>
              </rdf:li>
           </rdf:Bag>
        </pdfaExtension:schemas>
     </rdf:RDF>
...
Not only the namespace attributes xmlns:pdfaSchema and xmlns:pdfaProperty a=
re missing, but also the rdf:Description element is now called rdf:RDF (?!)
=20
I think it makes sense to create a Jira ticket for this issue. Since I am n=
ot a member of the project, shall I sign up and do this?
=20

Cheers

   J=C3=B6rn Willh=C3=B6ft

> J=C3=B6rn Willh=C3=B6ft <[email protected]> hat am 07.11.2024 13:34 CE=
T geschrieben:
> =20
> =20
> OK, I am a big step further now. The bug appears in Camel (only) if Saxon=
 is used anywhere in the Camel Route. I use Saxon to create the actual FO a=
nd additional files. The created FO has the namespaces where they belong, b=
ut somehow Saxon in the classpath seems to confuse the FOP component intern=
ally. Skipping Saxon is not really an option as I need XSLT 2.0.
> =20
> It is still unclear to me if the problem is in the Camel FOP component or=
 FOP itself.
> =20
> Cheers
>=20
>     J=C3=B6rn Willh=C3=B6ft
>=20

------=_Part_36027_1807406458.1730994535695
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!doctype html>
<html>
 <head>=20
  <meta charset=3D"UTF-8">=20
 </head>
 <body>
  <div>
   Well the bug is in Apache FOP (or maybe in Saxon?) Here is a reproducibl=
e test procedure:
  </div>=20
  <div class=3D"default-style">
   &nbsp;
  </div>=20
  <div class=3D"default-style">
   I use the FOP binary package from <a href=3D"https://www.apache.org/dyn/=
closer.cgi?filename=3D/xmlgraphics/fop/binaries/fop-2.10-bin.tar.gz&amp;act=
ion=3Ddownload">https://www.apache.org/dyn/closer.cgi?filename=3D/xmlgraphi=
cs/fop/binaries/fop-2.10-bin.tar.gz&amp;action=3Ddownload</a> and the curre=
nt Saxon 12.5 HE.
  </div>=20
  <div class=3D"default-style">
   &nbsp;
  </div>=20
  <div class=3D"default-style">
   Create PDF without Saxon:
  </div>=20
  <div class=3D"default-style">
   &nbsp;&nbsp; $ fop-2.10/fop/fop -c PDFA3Xmp.xconf -fo PDFXMP.fo -pdf out=
put-ok.pdf
  </div>=20
  <div class=3D"default-style">
   &nbsp;
  </div>=20
  <div class=3D"default-style">
   Create PDF with Saxon:
  </div>=20
  <div class=3D"default-style">
   &nbsp; $ export CLASSPATH=3DSaxonHE12-5J/saxon-he-12.5.jar:SaxonHE12-5J/=
lib/xmlresolver-5.2.2.jar:SaxonHE12-5J/lib/xmlresolver-5.2.2-data.jar:Saxon=
HE12-5J/lib/jline-2.14.6.jar
   <br>&nbsp; $ fop-2.10/fop/fop -c PDFA3Xmp.xconf -fo PDFXMP.fo -pdf outpu=
t-saxon.pdf
  </div>=20
  <div class=3D"default-style">
   &nbsp;
  </div>=20
  <div class=3D"default-style">
   Result without Saxon:
  </div>=20
  <div class=3D"default-style">
   <span style=3D"font-family: monospace;"><span style=3D"color: #000000; b=
ackground-color: #ffffff;" data-darkreader-inline-color=3D"" data-darkreade=
r-inline-bgcolor=3D"">&nbsp; $ pdfinfo -meta output-ok.pdf</span></span>
  </div>=20
  <div class=3D"default-style">
   <span style=3D"font-family: monospace;">...<br><span style=3D"color: #00=
0000; background-color: #ffffff;" data-darkreader-inline-color=3D"" data-da=
rkreader-inline-bgcolor=3D""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt=
;rdf:Description xmlns:pdfaExtension=3D"http://www.aiim.org/pdfa/ns/extensi=
on/" rdf:about=3D""&gt; </span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&lt;pdfaExtension:schemas&gt; <br>&nbsp;&nbs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gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&lt;/rdf:Description&gt;<br></span>
  </div>=20
  <div class=3D"default-style">
   <span style=3D"font-family: monospace;">...</span>
  </div>=20
  <div>
   &nbsp;
  </div>=20
  <div>
   The result with Saxon is totally messed up:
  </div>=20
  <div class=3D"default-style">
   <span style=3D"font-family: monospace;"><span style=3D"color: #000000; b=
ackground-color: #ffffff;" data-darkreader-inline-color=3D"" data-darkreade=
r-inline-bgcolor=3D"">$ pdfinfo -meta output-saxon.pdf</span><br></span>
  </div>=20
  <div class=3D"default-style">
   <span style=3D"font-family: monospace;"><span style=3D"color: #000000; b=
ackground-color: #ffffff;" data-darkreader-inline-color=3D"" data-darkreade=
r-inline-bgcolor=3D"">...</span></span>
  </div>=20
  <div class=3D"default-style">
   <span style=3D"font-family: monospace;"><span style=3D"color: #000000; b=
ackground-color: #ffffff;" data-darkreader-inline-color=3D"" data-darkreade=
r-inline-bgcolor=3D""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rdf:RDF xmlns:pdfa=
Extension=3D"http://www.aiim.org/pdfa/ns/extension/" rdf:about=3D""&gt; </s=
pan><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;pdfaExtension:s=
chemas&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&lt;rdf:Bag&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;rdf:li rdf:parseType=3D"Resource"&gt=
; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;pdfaSchema:property&gt; <br>&nbsp;&n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;&=
lt;/rdf:li&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&lt;/rdf:Bag&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&lt;/pdfaExtension:schemas&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/r=
df:RDF&gt;<br></span>
  </div>=20
  <div>
   ...
  </div>=20
  <div class=3D"default-style">
   Not only the namespace attributes <span style=3D"font-family: monospace;=
">xmlns:pdfaSchema</span> and <span style=3D"font-family: monospace;">xmlns=
:pdfaProperty</span> are missing, but also the rdf:Description element is n=
ow called rdf:RDF (?!)
  </div>=20
  <div class=3D"default-style">
   &nbsp;
  </div>=20
  <div>
   I think it makes sense to create a Jira ticket for this issue. Since I a=
m not a member of the project, shall I sign up and do this?
  </div>=20
  <div>
   &nbsp;
  </div>=20
  <div class=3D"io-ox-signature">=20
   <p>Cheers</p>=20
   <p>&nbsp;&nbsp; J=C3=B6rn Willh=C3=B6ft</p>=20
  </div>=20
  <blockquote type=3D"cite">=20
   <div>
    J=C3=B6rn Willh=C3=B6ft &lt;[email protected]&gt; hat am 07.11.2024 =
13:34 CET geschrieben:
   </div>=20
   <div>
    &nbsp;
   </div>=20
   <div>
    &nbsp;
   </div>=20
   <div>
    OK, I am a big step further now. The bug appears in Camel (only) if Sax=
on is used anywhere in the Camel Route. I use Saxon to create the actual FO=
 and additional files. The created FO has the namespaces where they belong,=
 but somehow Saxon in the classpath seems to confuse the FOP component inte=
rnally. Skipping Saxon is not really an option as I need XSLT 2.0.
   </div>=20
   <div class=3D"default-style">
    &nbsp;
   </div>=20
   <div class=3D"default-style">
    It is still unclear to me if the problem is in the Camel FOP component =
or FOP itself.
   </div>=20
   <div class=3D"default-style">
    &nbsp;
   </div>=20
   <div class=3D"default-style">
    Cheers
   </div>=20
   <div class=3D"io-ox-signature">=20
    <p>&nbsp;&nbsp;&nbsp; J=C3=B6rn Willh=C3=B6ft</p>=20
   </div>=20
  </blockquote>
 </body>
</html>
------=_Part_36027_1807406458.1730994535695--