add XML declaration to each split file in MarcXchangeWriter
This commit is contained in:
parent
dfefc49fee
commit
d2905637c1
4 changed files with 19 additions and 10 deletions
|
@ -489,21 +489,27 @@ public class MarcXchangeWriter extends MarcContentHandler implements Flushable,
|
|||
}
|
||||
|
||||
/**
|
||||
* Split records if configured.
|
||||
* Split records if configured. A splitlimit of -1 prevents splitting.
|
||||
*/
|
||||
private void afterRecord() {
|
||||
if (fileNamePattern != null && getRecordCounter() % splitlimit == 0) {
|
||||
if (fileNamePattern != null) {
|
||||
if (splitlimit != -1) {
|
||||
if (getRecordCounter() % splitlimit == 0) {
|
||||
try {
|
||||
endCollection();
|
||||
endDocument();
|
||||
writer.close();
|
||||
newWriter(fileNamePattern, fileNameCounter, bufferSize, compress);
|
||||
setupEventConsumer(writer, indent);
|
||||
startDocument();
|
||||
beginCollection();
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void newWriter(String fileNamePattern, AtomicInteger fileNameCounter,
|
||||
int bufferSize, boolean compress)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<collection xmlns="info:lc/xmlns/marcxchange-v2">
|
||||
<record format="MARC21" type="Bibliographic">
|
||||
<leader>01737nam 22004334a 4500</leader>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<collection xmlns="info:lc/xmlns/marcxchange-v2">
|
||||
<record format="MARC21" type="Bibliographic">
|
||||
<leader>01215cam 2200313 a 4500</leader>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<collection xmlns="info:lc/xmlns/marcxchange-v2">
|
||||
<record format="MARC21" type="Bibliographic">
|
||||
<leader>01613cam 2200409 a 4500</leader>
|
||||
|
|
Loading…
Reference in a new issue