From c7ea572e34e4c5025635caf27e74216e8861799a Mon Sep 17 00:00:00 2001 From: Pascal Christoph Date: Thu, 11 Jul 2024 16:54:25 +0200 Subject: [PATCH] WIP --- .../org/metafacture/biblio/marc21/MarcXmlEncoder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/MarcXmlEncoder.java b/metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/MarcXmlEncoder.java index 2271dafaa..2554eb605 100644 --- a/metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/MarcXmlEncoder.java +++ b/metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/MarcXmlEncoder.java @@ -252,6 +252,7 @@ private static class Encoder extends DefaultStreamPipe> { private int indentationLevel; private boolean formatted = PRETTY_PRINTED; private int recordAttributeOffset; + private int recordLeaderOffset; private Encoder() { } @@ -294,7 +295,7 @@ public void startRecord(final String identifier) { writeTag(Tag.record::open); recordAttributeOffset = builder.length() - 1; prettyPrintNewLine(); - + recordLeaderOffset = builder.length() - 1; incrementIndentationLevel(); } @@ -353,7 +354,7 @@ else if (!appendLeader(name, value)) { if (value != null) { writeEscaped(value.trim()); } - writeTag(Tag.controlfield::close); + writeTag(Tag.controlfield::close, false); prettyPrintNewLine(); } } @@ -408,6 +409,7 @@ private void writeFooter() { * @param str the unescaped sequence to be written */ private void writeRaw(final String str) { + builder.append(str); } @@ -434,7 +436,7 @@ private void writeLeader() { final String leader = leaderBuilder.toString(); if (!leader.isEmpty()) { prettyPrintIndentation(); - writeTag(Tag.leader::open); + writeTag(Tag.leader::open, false); writeRaw(leader); writeTag(Tag.leader::close); prettyPrintNewLine();