Bug 9415 - XML catalog export is missing root node
Summary: XML catalog export is missing root node
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Paul Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-17 10:42 UTC by Fridolin Somers
Modified: 2014-05-26 21:04 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (2.92 KB, patch)
2013-01-17 10:59 UTC, Fridolin Somers
Details | Diff | Splinter Review
Proposed patch (3.49 KB, patch)
2013-01-17 11:16 UTC, Fridolin Somers
Details | Diff | Splinter Review
Proposed patch (3.06 KB, patch)
2013-01-17 11:19 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 9415: XML catalog export is missing root node (3.42 KB, patch)
2013-01-18 20:31 UTC, Galen Charlton
Details | Diff | Splinter Review
Bug 9415: XML catalog export is missing root node (3.47 KB, patch)
2013-03-19 17:06 UTC, Paul Poulain
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2013-01-17 10:42:05 UTC
When exporting some biblio or authorities records with tools/export.pl (via web client or command-line) :
If choosing XML format, you get a concatenation of full XML records : 
<?xml version="1.0" encoding="UTF-8"?>
<record>
...
</record>
<?xml version="1.0" encoding="UTF-8"?>
<record>
...
</record>
...

This file should have a root node.

It should use MARC::File::XML:
http://search.cpan.org/~gmcharlt/MARC-XML-0.93/lib/MARC/File/XML.pm#close%28%29
Comment 1 Fridolin Somers 2013-01-17 10:59:08 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2013-01-17 11:16:58 UTC Comment hidden (obsolete)
Comment 3 Fridolin Somers 2013-01-17 11:19:46 UTC Comment hidden (obsolete)
Comment 4 Galen Charlton 2013-01-18 20:31:32 UTC Comment hidden (obsolete)
Comment 5 Paul Poulain 2013-03-19 17:05:50 UTC
QA comment
 * small patch, that sounds logical and fixes a nasty problem
 * passes koha-qa.pl

passed QA
Comment 6 Paul Poulain 2013-03-19 17:06:31 UTC
Created attachment 16432 [details] [review]
Bug 9415: XML catalog export is missing root node

When exporting some biblio or authorities records with tools/export.pl (via web client or command-line) :
If choosing XML format, you get a concatenation of full XML records.

This patch uses MARC::File::XML to create a well formated file.
See http://search.cpan.org/~gmcharlt/MARC-XML-0.93/lib/MARC/File/XML.pm#close%28%29

Test plan:
- Go to Tools/Export data
- Enter numbers in from and to biblio number
  (make sure that at least two records will
   be exported).
- Select xml in file format
- Click "Export bibliographic records"
- Save file somewhere
- Look at downloaded file
=> File should look like :
   <?xml version="1.0" encoding="UTF-8"?>
   <collection
   ...

   <record>
   ...
   </record>

   <record>
   ...
   </record>

   </collection>
=> "collection" is the root node and XML declaration exists only once
- Do the same for authorities export and command-line use of tools/export.pl

Second test plan:

- From the command line, run tools/export.pl, e.g.,

  tools/export.pl  --format=xml --filename=bibs.xml

- Verify that the output is valid XML, e.g.,

  xmllint --noout bibs.xml # if the file is valid, no error messages will be displayed

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 7 Jared Camins-Esakov 2013-03-20 02:07:47 UTC
This patch has been pushed to master.
Comment 8 Chris Cormack 2013-03-29 06:34:52 UTC
Pushed to 3.10.x will be in 3.10.5