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

Error while parsing metadata #67

Open
mdcarreira opened this issue Sep 6, 2017 · 1 comment
Open

Error while parsing metadata #67

mdcarreira opened this issue Sep 6, 2017 · 1 comment

Comments

@mdcarreira
Copy link

Giving the following response XML from an OAI repository:

<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
   ...
   <ListRecords>
      <record>
         <header>
            ...
         </header>
         <metadata>
            <crossref xmlns="http://www.crossref.org/xschema/1.1" xsi:schemaLocation="http://www.crossref.org/xschema/1.1 http://www.crossref.org/schema/unixref1.1.xsd">
               ...
            </crossref>
         </metadata>
      </record>
   </ListRecords>
</OAI-PMH>

We get an error if we try to parse it using XOAI.

ERROR: 'The prefix "xsi" for attribute "xsi:schemaLocation" associated with an element type "crossref" is not bound.'

From what I could deduce from reading the source code and debugging, each metadata node is parsed individually by the XOAI library. And, in that context, the xsi prefix is indeed not bound, as it is only defined in parent node OAI-PMH.

There should be a way to configure the XML reader to ignore namespace errors.

@richard-jones
Copy link
Member

richard-jones commented Mar 22, 2023

Is there any further developments on this one?

The xml serialiser we use (lxml) won't repeat namespaces, so the oai_dc element does not define the xsi namespace, since it is already represented at the top of the OAI-PMH document. While this is technically not spec compliant, it is valid XML, and it would be helpful if the XOAI library could cope with that.

See the referenced bug report for details DOAJ/doaj#2186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants