[Archivesspace_Users_Group] FW: Unable to create Accession Report in PDF

Majewski, Steven Dennis (sdm7g) sdm7g at virginia.edu
Fri Jul 26 13:14:21 EDT 2019


v2.6.0 added a fix for the dreaded unescaped ampersands in EAD export ( and PDF export from staff interface, which generates EAD and transforms to PDF, where malformed XML in the export stage is the usually problem when PDF export fails. ),

https://github.com/archivesspace/archivesspace/commit/18f2f5100e8aa4510c61158a9accf279fb60e895 <https://github.com/archivesspace/archivesspace/commit/18f2f5100e8aa4510c61158a9accf279fb60e895>


 but I don’t think it will fix this issue in the report generator. 

I think adding some code to this clean_invalid_xml_characters() function to detect and escape unescaped ampersands might be the place to fix it:

https://github.com/archivesspace/archivesspace/blob/master/backend/app/lib/reports/report_generator.rb#L126-L136 <https://github.com/archivesspace/archivesspace/blob/master/backend/app/lib/reports/report_generator.rb#L126-L136>



— Steve. 


> On Jul 26, 2019, at 1:03 PM, Blake Carver <blake.carver at lyrasis.org> wrote:
> 
> What version are you running? There's a bunch of fixes in the new version for the dreaded ampersands!
> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Zhang, Bin <bzhang at csus.edu>
> Sent: Friday, July 26, 2019 12:31 PM
> To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
> Subject: Re: [Archivesspace_Users_Group] FW: Unable to create Accession Report in PDF
>  
> Thanks Blake!  We do have “&” in accession records (in title and various other fields).  It’s going to be a lot of work to replace all of them.  Is this something the software can look for and take care of?  We were able to get the same report in other formats with no problem (JSON, RTF, HTML). 
>  
> -- 
> Bin
>  
> From: <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Blake Carver <blake.carver at lyrasis.org>
> Reply-To: Archivesspace Group <archivesspace_users_group at lyralists.lyrasis.org>
> Date: Thursday, July 25, 2019 at 2:15 PM
> To: Archivesspace Group <archivesspace_users_group at lyralists.lyrasis.org>
> Subject: Re: [Archivesspace_Users_Group] FW: Unable to create Accession Report in PDF
>  
>  
> "The entity name must immediately follow the '&' in the entity reference."
>  
> That makes me think there's an ampersand in that record and it's choking on it when it tries to make the PDF.
>  
> Is there anything in there with ampersands? Like "J&J Automotive" or something?
> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Zhang, Bin <bzhang at csus.edu>
> Sent: Thursday, July 25, 2019 4:26 PM
> To: Archivesspace Group <archivesspace_users_group at lyralists.lyrasis.org>
> Subject: [Archivesspace_Users_Group] FW: Unable to create Accession Report in PDF
>  
> We are having problem creating Accession Report in PDF format.  All other formats (JSON, CSV, RTF) are working, just not the PDF format.  I have attached log below.
>  
> Any help is greatly appreciated.
>  
> Bin
>  
> Log
> Follow Log
> Generating report
> 
> Can't load the XML resource (using TRaX transformer). org.xml.sax.SAXParseException; lineNumber: 316990; columnNumber: 95; The entity name must immediately follow the '&' in the entity reference.
> 
> org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(org/xhtmlrenderer/resource/XMLResource.java:191)
> 
> org.xhtmlrenderer.resource.XMLResource.load(org/xhtmlrenderer/resource/XMLResource.java:71)
> 
> org.xhtmlrenderer.swing.NaiveUserAgent.getXMLResource(org/xhtmlrenderer/swing/NaiveUserAgent.java:211)
> 
> org.xhtmlrenderer.pdf.ITextRenderer.loadDocument(org/xhtmlrenderer/pdf/ITextRenderer.java:134)
> 
> org.xhtmlrenderer.pdf.ITextRenderer.setDocument(org/xhtmlrenderer/pdf/ITextRenderer.java:149)
> 
> java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
> 
> org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:453)
> 
> org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:314)
> 
> RUBY.generate_pdf(/data/archivesspace/data/tmp/jetty-0.0.0.0-8089-backend.war-_-any-/webapp/WEB-INF/app/lib/reports/report_generator.rb:54)
> 
> RUBY.generate(/data/archivesspace/data/tmp/jetty-0.0.0.0-8089-backend.war-_-any-/webapp/WEB-INF/app/lib/reports/report_generator.rb:26)
> 
> RUBY.run(/data/archivesspace/data/tmp/jetty-0.0.0.0-8089-backend.war-_-any-/webapp/WEB-INF/app/lib/job_runners/reports_runner.rb:39)
> 
> data.archivesspace.data.tmp.jetty_minus_0_dot_0_dot_0_dot_0_minus_8089_minus_backend_dot_war_minus___minus_any_minus_.webapp.WEB_minus_INF.app.lib.background_job_queue.invokeOther45:run(data/archivesspace/data/tmp/jetty_minus_0_dot_0_dot_0_dot_0_minus_8089_minus_backend_dot_war_minus___minus_any_minus_/webapp/WEB_minus_INF/app/lib//data/archivesspace/data/tmp/jetty-0.0.0.0-8089-backend.war-_-any-/webapp/WEB-INF/app/lib/background_job_queue.rb:126)
> 
> data.archivesspace.data.tmp.jetty_minus_0_dot_0_dot_0_dot_0_minus_8089_minus_backend_dot_war_minus___minus_any_minus_.webapp.WEB_minus_INF.app.lib.background_job_queue.run_pending_job(/data/archivesspace/data/tmp/jetty-0.0.0.0-8089-backend.war-_-any-/webapp/WEB-INF/app/lib/background_job_queue.rb:126)
> 
> RUBY.block in start_background_thread(/data/archivesspace/data/tmp/jetty-0.0.0.0-8089-backend.war-_-any-/webapp/WEB-INF/app/lib/background_job_queue.rb:169)
> 
> org.jruby.RubyProc.call(org/jruby/RubyProc.java:289)
> 
> org.jruby.RubyProc.call(org/jruby/RubyProc.java:246)
> 
> java.lang.Thread.run(java/lang/Thread.java:748)
> 
> Done.
> 
>  
>  
> ---
> Bin Zhang
> Digital Information Services Librarian
> Library Systems & IT Services, University Library
> California State University, Sacramento
> +1 (916) 278-5664 | bzhang at csus.edu <mailto:bzhang at csus.edu>
> Zoom: https://csus.zoom.us/my/bzhang
>  
>  
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20190726/5602efab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4974 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20190726/5602efab/attachment.bin>


More information about the Archivesspace_Users_Group mailing list