Open bertsky opened 1 year ago
org.xml.sax.SAXParseException: cvc-type.3.1.1: Element 'mets:note' is a simple type, so it cannot have attributes, excepting those whose namespace name is identical to 'http://www.w3.org/2001/XMLSchema-instance' and whose [local name] is one of 'type', 'nil', 'schemaLocation' or 'noNamespaceSchemaLocation'. However, the attribute, 'ocrd:option' was found.
Perhaps MyCore's METS model is based on an older version of the METS schema? They added xsd:anyAttribute
to mets:note
only recently (May 2018 / v 1.12).
It is not related to an actual METS-version. Under the hood mets-model uses rather old XML-Libraries: jdom:2.0.6 (2015) and jaxen:1.2.0 (2019), which don't like inline namespace declarations, hence the parser error.
By now it helps probably to register the ocrd-namespace once in the regular prologue at the root and then just refer internally like it was of old. I guess Python's lxml library provides means like lxml.etree.cleanup_namespace
for this case.
Oh, that sounds very plausible.
By now it helps probably to register the ocrd-namespace once in the regular prologue at the root and then just refer internally like it was of old.
Yes, perhaps we should generate that correctly in core to begin with.
I guess Python's lxml library provides means like
lxml.etree.cleanup_namespace
for this case.
Interesting. This does work, you just need to pass it a kwarg top_nsmap={"ocrd": "https://ocr-d.de"}
.
@bertsky Would you mind to re-tackle this as brand new issue on mets-model project, which does the actual METS-handling?
@bertsky Would you mind to re-tackle this as brand new issue on mets-model project, which does the actual METS-handling?
I'd rather solve it in core.
with our typical
mets:metsHdr/mets:agent
section, e.g. ……(which is valid by XSD validation in xmllint/xmlstarlet) I get the following exception: