Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ public void literal(final String name, final String value) {
if (name.equals(Marc21EventNames.MARCXML_TYPE_LITERAL)) {
if (value != null) {
builder.insert(recordAttributeOffset, String.format(ATTRIBUTE_TEMPLATE, name, value));
recordLeaderOffset = builder.length();
}
}
else if (!appendLeader(name, value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,21 @@ public void issue336_createRecordWithTopLevelLeader_dummy() {
assertEquals(expected, actual);
}

@Test
public void issue548_createRecordWithTypeAttributeInRecordTagAndLeader() {
encoder.startRecord(RECORD_ID);
encoder.literal("type", "Bibliographic");
encoder.startEntity(Marc21EventNames.LEADER_ENTITY);
encoder.literal(Marc21EventNames.LEADER_ENTITY, "dummy");
encoder.endEntity();
encoder.endRecord();
encoder.closeStream();
String expected = XML_DECLARATION + XML_ROOT_OPEN + "<marc:record type=\"Bibliographic\">" +
"<marc:leader>dummy</marc:leader></marc:record>" + XML_MARC_COLLECTION_END_TAG;
String actual = resultCollector.toString();
assertEquals(expected, actual);
}

@Test
public void issue336_createRecordWithTopLevelLeader_defaultMarc21Xml() {
issue336_createRecordWithTopLevelLeader(encoder, "00000naa a2200000uc 4500");
Expand Down
Loading