Not yet sure my diagnosis was correct. Looks like there is an xml_clean!()  
Function:

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


That gets called in the view template for PDF output:
https://github.com/archivesspace/archivesspace/blob/master/backend/app/views/reports/report_content.erb#L1-L4
 
<https://github.com/archivesspace/archivesspace/blob/master/backend/app/views/reports/report_content.erb#L1-L4>


So we need to investigate further and see if it’s working as intended. 
( meanwhile: I’m getting MariaDB errors trying to run reports… [other thread] )

— Steve. 





> On Jul 26, 2019, at 5:08 PM, Zhang, Bin <[email protected]> wrote:
> 
> Thanks Steven and Blake!  Now can someone with power fix this soon?
>  
> ---
> Bin Zhang
> Digital Information Services Librarian
> Library Systems & IT Services, University Library
> California State University, Sacramento
> +1 (916) 278-5664 | [email protected] <mailto:[email protected]>
> Zoom: https://csus.zoom.us/my/ <https://csus.zoom.us/my/bzhang>bzhang 
> <https://csus.zoom.us/my/bzhang>
>  
>  
>  
> From: <[email protected]> on behalf of 
> "Majewski, Steven Dennis (sdm7g)" <[email protected]>
> Reply-To: Archivesspace Group 
> <[email protected]>
> Date: Friday, July 26, 2019 at 10:14 AM
> To: Archivesspace Group <[email protected]>
> Subject: Re: [Archivesspace_Users_Group] FW: Unable to create Accession 
> Report in PDF
>  
> 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 <[email protected] 
>> <mailto:[email protected]>> wrote:
>>  
>> What version are you running? There's a bunch of fixes in the new version 
>> for the dreaded ampersands!
>> From: [email protected] 
>> <mailto:[email protected]> 
>> <[email protected] 
>> <mailto:[email protected]>> on behalf 
>> of Zhang, Bin <[email protected] <mailto:[email protected]>>
>> Sent: Friday, July 26, 2019 12:31 PM
>> To: Archivesspace Users Group 
>> <[email protected] 
>> <mailto:[email protected]>>
>> 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: <[email protected] 
>> <mailto:[email protected]>> on behalf 
>> of Blake Carver <[email protected] <mailto:[email protected]>>
>> Reply-To: Archivesspace Group 
>> <[email protected] 
>> <mailto:[email protected]>>
>> Date: Thursday, July 25, 2019 at 2:15 PM
>> To: Archivesspace Group <[email protected] 
>> <mailto:[email protected]>>
>> 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: [email protected] 
>> <mailto:[email protected]> 
>> <[email protected] 
>> <mailto:[email protected]>> on behalf 
>> of Zhang, Bin <[email protected] <mailto:[email protected]>>
>> Sent: Thursday, July 25, 2019 4:26 PM
>> To: Archivesspace Group <[email protected] 
>> <mailto:[email protected]>>
>> 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 | [email protected] <mailto:[email protected]>
>> Zoom: https://csus.zoom.us/my/ <https://csus.zoom.us/my/>bzhang
>>  
>>  
>> _______________________________________________
>> Archivesspace_Users_Group mailing list
>> [email protected] 
>> <mailto:[email protected]>
>> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group 
>> <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
> 
> 
> _______________________________________________
> Archivesspace_Users_Group mailing list
> [email protected] 
> <mailto:[email protected]>
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group 
> <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Archivesspace_Users_Group mailing list
[email protected]
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

Reply via email to