Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encode-marcxml should output leader as first element, all controlfield after that and then all datafields after that #548

Open
TobiasNx opened this issue Jul 3, 2024 · 8 comments · Fixed by #549
Assignees
Labels

Comments

@TobiasNx
Copy link
Contributor

TobiasNx commented Jul 3, 2024

With the last release encode-marcxml outputs the leader as last element, it should be the first.
See: https://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd

<xsd:complexType name="recordType" id="record.ct">
<xsd:sequence minOccurs="0">
<xsd:element name="leader" type="leaderFieldType"/>
<xsd:element name="controlfield" type="controlFieldType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="datafield" type="dataFieldType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="type" type="recordTypeType" use="optional"/>
<xsd:attribute name="id" type="idDataType" use="optional"/>
</xsd:complexType>
@TobiasNx TobiasNx added the Bug label Jul 4, 2024
@TobiasNx TobiasNx changed the title encode-marcxml should output leader as first element encode-marcxml should output leader as first element, all controlfield after that and then all datafields after that Jul 4, 2024
@dr0i
Copy link
Member

dr0i commented Jul 12, 2024

I get that the marc:leader has to be the first element and implemented that in #549.
I don't get your second comment "Idea for tests", though. Especially, the marc:leader has just always to be emitted first - which it does with #549 , regardless of the setting of ensureCorrectMarc21Xml="true".

@dr0i dr0i self-assigned this Jul 12, 2024
@dr0i dr0i added this to Metafacture Jul 12, 2024
@dr0i dr0i moved this to Review in Metafacture Jul 12, 2024
@dr0i dr0i closed this as completed in #549 Jul 12, 2024
@github-project-automation github-project-automation bot moved this from Review to Done in Metafacture Jul 12, 2024
@dr0i
Copy link
Member

dr0i commented Jul 12, 2024

Have a look @TobiasNx after your vacation.

@dr0i
Copy link
Member

dr0i commented Jul 15, 2024

Did the functional review together with @maipet . Looks good, structurally, but indentation is not pretty. As this is merely an aesthetic thing we will build the new release upon this.
Opened #550.

@dr0i
Copy link
Member

dr0i commented Sep 2, 2024

Nothing to do here. Closing.

@dr0i dr0i closed this as completed Sep 2, 2024
@TobiasNx TobiasNx reopened this Sep 16, 2024
@dr0i dr0i moved this from Done to Selected in Metafacture Sep 16, 2024
@TobiasNx
Copy link
Contributor Author

TobiasNx commented Sep 16, 2024

test.metafacture.org/playground?flux=%22https%3A//d-nb.info/1106253078/about/marcxml%22%0A%7C+open-http%28accept%3D%22application/xml%22%29%0A%7C+decode-xml%0A%7C+handle-marcxml%0A%7C+encode-marcxml%0A%7C+print%0A%3B

This scenario outputs the leader wrong as part of the record tag.

IS: <marc:record t<marc:leader>00000naa a2200000uc 4500</marc:leader>ype="Bibliographic">

SHOULD BE:

<marc:record type="Bibliographic">
	<marc:leader>00000naa a2200000uc 4500</marc:leader>

PS: https://test.metafacture.org/playground/?flux=%22https%3A//d-nb.info/1106253078/about/marcxml%22%0A%7C+open-http%28accept%3D%22application/xml%22%29%0A%7C+decode-xml%0A%7C+handle-marcxml%0A%7C+encode-yaml%0A%7C+print%0A%3B

It seems that type is its own top-level element coming out of handle-marcxml

---
type: "Bibliographic"
leader: "00000naa a2200000uc 4500"

@TobiasNx
Copy link
Contributor Author

TobiasNx commented Sep 16, 2024

An additional note while the position of the leader element is fixed (with minor error when a type statement is given)

This ticket should have suggested that the orders matters not only with the leader but with the data and control fields too:

<xsd:sequence minOccurs="0">
<xsd:element name="leader" type="leaderFieldType"/>
<xsd:element name="controlfield" type="controlFieldType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="datafield" type="dataFieldType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>

within the record tag:

<record type="Bibliographic">
    <leader>...</leader>
    <controlfield>...</controlfield>
    <controlfield>...</controlfield>
    <controlfield>...</controlfield>
    ...
    <datafield>...</datafield>
    <datafield>...</datafield>
    <datafield>...</datafield>
    <datafield>...</datafield>
</record>

Data and controlfields should not be mixed. The general order should be leader, then ALL controllfields, then all datafields to create valid marc xml.

@dr0i
Copy link
Member

dr0i commented Sep 23, 2024

In part fixed with #558.
Other than discussed at our meeting today I pledge for opening a new issue re. #548 (comment). There should be a link to a playground example that shows the problem. Could you do that @TobiasNx ?

@dr0i dr0i assigned TobiasNx and unassigned dr0i Sep 23, 2024
@TobiasNx TobiasNx moved this from Review to Ready in Metafacture Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready
Development

Successfully merging a pull request may close this issue.

2 participants